idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
23,700
public static RecordingTransaction wrap ( Transaction tx , Predicate < LogEntry > filter ) { return new RecordingTransaction ( tx , filter ) ; }
Creates a RecordingTransaction using the provided LogEntry filter and existing Transaction
23,701
protected InputContainerElements scan ( final UIComponent component , InputContainerElements elements , final FacesContext context ) { if ( elements == null ) { elements = new InputContainerElements ( ) ; } if ( ( elements . getLabel ( ) == null ) && ( component instanceof HtmlOutputLabel ) ) { elements . setLabel ( ( ...
Walk the component tree branch built by the composite component and locate the input container elements .
23,702
public void assignIds ( final InputContainerElements elements , final FacesContext context ) { boolean refreshIds = false ; if ( getId ( ) . startsWith ( UIViewRoot . UNIQUE_ID_PREFIX ) ) { setId ( elements . getPropertyName ( context ) ) ; refreshIds = true ; } UIComponent label = elements . getLabel ( ) ; if ( label ...
assigning ids seems to break form submissions but I don t know why
23,703
private Validator getDefaultValidator ( final FacesContext context ) throws FacesException { if ( ! beanValidationPresent ) { return null ; } ValidatorFactory validatorFactory ; Object cachedObject = context . getExternalContext ( ) . getApplicationMap ( ) . get ( BeanValidator . VALIDATOR_FACTORY_KEY ) ; if ( cachedOb...
Get the default Bean Validation Validator to read the contraints for a property .
23,704
public SetType getBlockedThreads ( ) { Set < ThreadType > blocked = new LinkedHashSet < ThreadType > ( ) ; for ( ThreadType thread : runtime . getThreads ( ) ) { if ( thread == this ) continue ; if ( getAcquiredLocks ( ) . contains ( thread . getWaitingToLock ( ) ) ) { blocked . add ( thread ) ; } } return runtime . ge...
Get threads that are waiting for lock held by this thread .
23,705
public SetType getBlockingThreads ( ) { final ThreadType blocking = getBlockingThread ( ) ; if ( blocking == null ) return runtime . getEmptyThreadSet ( ) ; return runtime . getThreadSet ( Collections . singleton ( blocking ) ) ; }
Get threads holding lock this thread is trying to acquire .
23,706
public ThreadType getBlockingThread ( ) { if ( state . waitingToLock == null && state . waitingOnLock == null ) { return null ; } for ( ThreadType thread : runtime . getThreads ( ) ) { if ( thread == this ) continue ; Set < ThreadLock > acquired = thread . getAcquiredLocks ( ) ; if ( acquired . isEmpty ( ) ) continue ;...
Get thread blocking this threads execution .
23,707
private void init ( String xmlPath ) throws MalformedURLException , IOException { XML xml = new XML ( true , xmlPath ) ; if ( ! xml . isInheritedMapped ( configuredClass ) ) Error . classNotMapped ( configuredClass ) ; for ( Class < ? > classe : getClasses ( xml ) ) { relationalManyToOneMapper . put ( classe . getName ...
This method initializes relational maps starting from XML .
23,708
private Set < Class < ? > > getClasses ( XML xml ) { HashSet < Class < ? > > result = new HashSet < Class < ? > > ( ) ; Global global = null ; for ( Class < ? > clazz : getAllsuperClasses ( configuredClass ) ) { if ( isNull ( global ) ) { global = xml . loadGlobals ( ) . get ( clazz . getName ( ) ) ; if ( ! isNull ( gl...
Returns all Target Classes contained in the XML .
23,709
private void init ( ) { if ( ! Annotation . isInheritedMapped ( configuredClass ) ) Error . classNotMapped ( configuredClass ) ; for ( Class < ? > classe : getClasses ( ) ) { relationalManyToOneMapper . put ( classe . getName ( ) , new JMapper ( configuredClass , classe , ChooseConfig . DESTINATION ) ) ; relationalOneT...
This method initializes relational maps
23,710
private Set < Class < ? > > getClasses ( ) { HashSet < Class < ? > > result = new HashSet < Class < ? > > ( ) ; JGlobalMap jGlobalMap = null ; for ( Class < ? > clazz : getAllsuperClasses ( configuredClass ) ) { if ( isNull ( jGlobalMap ) ) { jGlobalMap = clazz . getAnnotation ( JGlobalMap . class ) ; if ( ! isNull ( j...
Returns all Target Classes
23,711
private < I > I destinationClassControl ( Exception exception , Class < I > clazz ) { try { if ( clazz == null ) throw new IllegalArgumentException ( "it's mandatory define the destination class" ) ; } catch ( Exception e ) { JmapperLog . error ( e ) ; return null ; } return logAndReturnNull ( exception ) ; }
This method verifies that the destinationClass exists .
23,712
private < D , S > JMapper < D , S > getJMapper ( HashMap < String , JMapper > map , Object source ) { Class < ? > sourceClass = source instanceof Class ? ( ( Class < ? > ) source ) : source . getClass ( ) ; JMapper < D , S > jMapper = map . get ( sourceClass . getName ( ) ) ; if ( jMapper == null ) Error . classNotMapp...
Returns the desired JMapper instance .
23,713
public Global excludedAttributes ( String ... attributes ) { for ( String attribute : attributes ) global . excluded . add ( new XmlExcludedAttribute ( attribute ) ) ; return this ; }
Attributes to exclude from mapping .
23,714
public Global targetClasses ( Class < ? > ... classes ) { for ( Class < ? > targetClass : classes ) global . classes . add ( new TargetClass ( targetClass ) . toXStream ( ) ) ; return this ; }
Target classes .
23,715
public boolean isUndefined ( final Field destination , final Field source ) { info = null ; for ( IOperationAnalyzer analyzer : analyzers ) if ( analyzer . verifyConditions ( destination , source ) ) info = analyzer . getInfoOperation ( destination , source ) ; if ( isNull ( info ) ) info = undefinedOperation ( ) ; boo...
This method analyzes the fields calculates the info and returns true if operation is undefined .
23,716
private String getValue ( final String value , final String mappedFieldName ) { if ( isNull ( value ) ) return null ; return value . equals ( DEFAULT_FIELD_VALUE ) ? mappedFieldName : value ; }
This method compare the name of the target field with the DEFAULT_FIELD_VALUE and returns the final value .
23,717
private String getValue ( final List < String > attributes , final List < Class < ? > > classes , String value , final String mappedFieldName , final Class < ? > configuredClass , final Class < ? > targetClass ) { String regex = getValue ( value , mappedFieldName ) ; String mappedClassName = configuredClass . getSimple...
This method finds the target field name from mapped parameters .
23,718
public void loadAccessors ( Class < ? > targetClass , MappedField configuredField , MappedField targetField ) { xml . fillMappedField ( configuredClass , configuredField ) . fillMappedField ( targetClass , targetField ) . fillOppositeField ( configuredClass , configuredField , targetField ) ; Annotation . fillMappedFie...
Fill fields with they custom methods .
23,719
public List < ConversionMethod > getConversionMethods ( Class < ? > clazz ) { List < ConversionMethod > conversions = new ArrayList < ConversionMethod > ( ) ; Map < String , List < ConversionMethod > > conversionsMap = this . conversionsLoad ( ) ; for ( Class < ? > classToCheck : getAllsuperClasses ( clazz ) ) { List <...
Returns the conversions method belonging to clazz .
23,720
public List < String > getClasses ( ) { List < String > classes = new ArrayList < String > ( ) ; for ( XmlClass xmlClass : xmlJmapper . classes ) classes . add ( xmlClass . name ) ; return classes ; }
Returns a list with the classes names presents in xml mapping file .
23,721
public XML write ( ) { try { FilesManager . write ( xmlJmapper , xmlPath ) ; } catch ( IOException e ) { JmapperLog . error ( e ) ; } return this ; }
Writes the xml mapping file starting from xmlJmapper object .
23,722
public XML deleteClass ( Class < ? > aClass ) { boolean isRemoved = xmlJmapper . classes . remove ( new XmlClass ( aClass . getName ( ) ) ) ; if ( ! isRemoved ) Error . xmlClassInexistent ( this . xmlPath , aClass ) ; return this ; }
This method remove a specific Class from Xml Configuration File
23,723
public XML addGlobal ( Class < ? > aClass , Global global ) { checksGlobalAbsence ( aClass ) ; findXmlClass ( aClass ) . global = Converter . toXmlGlobal ( global ) ; return this ; }
This method adds the global to an existing Class .
23,724
public XML deleteGlobal ( Class < ? > aClass ) { checksGlobalExistence ( aClass ) ; XmlClass xmlClass = findXmlClass ( aClass ) ; if ( isEmpty ( xmlClass . attributes ) ) deleteClass ( aClass ) ; else xmlClass . global = null ; return this ; }
This method deletes the global to an existing Class .
23,725
public XML addAttributes ( Class < ? > aClass , Attribute [ ] attributes ) { checksAttributesExistence ( aClass , attributes ) ; for ( Attribute attribute : attributes ) { if ( attributeExists ( aClass , attribute ) ) Error . xmlAttributeExistent ( this . xmlPath , attribute , aClass ) ; findXmlClass ( aClass ) . attri...
This method adds the attributes to an existing Class .
23,726
public XML deleteAttributes ( Class < ? > aClass , String [ ] attributes ) { checksAttributesExistence ( aClass , attributes ) ; if ( isEmpty ( findXmlClass ( aClass ) . attributes ) || findXmlClass ( aClass ) . attributes . size ( ) <= 1 ) Error . xmlWrongMethod ( aClass ) ; for ( String attributeName : attributes ) {...
This method deletes the attributes to an existing Class .
23,727
private XML addClass ( Class < ? > aClass ) { xmlJmapper . classes . add ( Converter . toXmlClass ( aClass ) ) ; return this ; }
Adds an annotated Class to xmlJmapper structure .
23,728
private XML checksClassAbsence ( Class < ? > aClass ) { if ( classExists ( aClass ) ) Error . xmlClassExistent ( this . xmlPath , aClass ) ; return this ; }
Throws an exception if the class exist .
23,729
private boolean classExists ( Class < ? > aClass ) { if ( xmlJmapper . classes == null ) return false ; return findXmlClass ( aClass ) != null ? true : false ; }
verifies that this class exist in Xml Configuration File .
23,730
private boolean attributeExists ( Class < ? > aClass , Attribute attribute ) { if ( ! classExists ( aClass ) ) return false ; for ( XmlAttribute xmlAttribute : findXmlClass ( aClass ) . attributes ) if ( xmlAttribute . name . equals ( attribute . getName ( ) ) ) return true ; return false ; }
This method returns true if the attribute exist in the Class given in input returns false otherwise .
23,731
private XmlClass findXmlClass ( Class < ? > aClass ) { for ( XmlClass xmlClass : xmlJmapper . classes ) if ( xmlClass . name . equals ( aClass . getName ( ) ) ) return xmlClass ; return null ; }
Finds the Class given in input in the xml mapping file and returns a XmlClass instance if exist null otherwise .
23,732
public boolean isMapped ( Class < ? > classToCheck ) { return ! isNull ( loadGlobals ( ) . get ( classToCheck . getName ( ) ) ) || ! isEmpty ( loadAttributes ( ) . get ( classToCheck . getName ( ) ) ) ; }
Returns true if the class is configured in xml false otherwise .
23,733
public XML fillMappedField ( Class < ? > configuredClass , MappedField configuredField ) { Attribute attribute = getGlobalAttribute ( configuredField , configuredClass ) ; if ( isNull ( attribute ) ) attribute = getAttribute ( configuredField , configuredClass ) ; if ( ! isNull ( attribute ) ) { if ( isEmpty ( configur...
Enrich configuredField with get and set define in xml configuration .
23,734
public XML fillOppositeField ( Class < ? > configuredClass , MappedField configuredField , MappedField targetField ) { Attribute attribute = null ; Global global = loadGlobals ( ) . get ( configuredClass . getName ( ) ) ; if ( ! isNull ( global ) ) { String value = global . getValue ( ) ; if ( ! isEmpty ( value ) && va...
Enrich targetField with get and set define in xml configuration .
23,735
public static boolean safeNavigationOperatorDefined ( String nestedFieldName ) { if ( nestedFieldName . contains ( SAFE_NAVIGATION_OPERATOR ) ) if ( ! nestedFieldName . startsWith ( SAFE_NAVIGATION_OPERATOR ) ) throw new MappingException ( "Safe navigation operator must be the first symbol after dot notation" ) ; else ...
It checks the presence of the elvis operator and how it is used .
23,736
private static MappedField checkGetAccessor ( XML xml , Class < ? > aClass , Field nestedField ) { MappedField field = new MappedField ( nestedField ) ; xml . fillMappedField ( aClass , field ) ; Annotation . fillMappedField ( aClass , field ) ; verifyGetterMethods ( aClass , field ) ; return field ; }
Checks only get accessor of this field .
23,737
private static MappedField checkAccessors ( XML xml , Class < ? > aClass , Field nestedField ) { MappedField field = checkGetAccessor ( xml , aClass , nestedField ) ; verifySetterMethods ( aClass , field ) ; return field ; }
Checks get and set accessors of this field .
23,738
public static NestedMappingInfo loadNestedMappingInformation ( XML xml , Class < ? > targetClass , String nestedMappingPath , Class < ? > sourceClass , Class < ? > destinationClass , Field configuredField ) { boolean isSourceClass = targetClass == sourceClass ; NestedMappingInfo info = new NestedMappingInfo ( isSourceC...
This method returns a bean with nested mapping information .
23,739
public static AGeneralOperation getOperation ( OperationType operationType ) { switch ( operationType ) { case BASIC_INSTRUCTION : return new BasicOperation ( ) ; case BASIC_CONVERSION : return new BasicConversion ( ) ; case OBJECT : return new ObjectOperation ( ) ; case ARRAY : return new ArrayOperation ( ) ; case ARR...
Operation factory .
23,740
public static InputStream loadResource ( String resource ) throws MalformedURLException , IOException { String content = resource . trim ( ) ; if ( ! isPath ( content ) ) return new ByteArrayInputStream ( content . getBytes ( "UTF-8" ) ) ; URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource (...
Returns an instance of inputStream if resource exists null otherwise .
23,741
public boolean fieldsToCheck ( Field destination , Field source ) { destinationName = destination . getName ( ) ; sourceName = source . getName ( ) ; if ( ! xml . conversionsLoad ( ) . isEmpty ( ) ) { configurationType = XML ; if ( config == DESTINATION ) { if ( existsXmlConversion ( destinationClass ) ) { membership =...
Checks for the existence of a conversion method .
23,742
private boolean exists ( List < ConversionMethod > conversions ) { if ( conversions . isEmpty ( ) ) return false ; return ( method = verifyConversionExistence ( conversions ) ) != null ; }
Verifies the conversion method existence returns true if exists false otherwise .
23,743
private ConversionMethod verifyConversionExistence ( List < ConversionMethod > conversions ) { for ( ConversionMethod method : conversions ) if ( isPresentIn ( method . getFrom ( ) , sourceName ) && isPresentIn ( method . getTo ( ) , destinationName ) ) return method ; return null ; }
This method finds the conversion method between those loaded .
23,744
private boolean isPresentIn ( String [ ] values , String field ) { for ( String value : values ) if ( value . equalsIgnoreCase ( JMapConversion . ALL ) || value . equals ( field ) ) return true ; return false ; }
Returns true if the field name is contained in the values array false otherwise .
23,745
public static void nestedBeanNull ( String currentField , String destinationClass , String destinationField , String sourceClass , String sourceField , boolean safeNavigationOperator ) { throw new NestedBeanNullException ( MSG . INSTANCE . message ( nestedBeanNullException , currentField , destinationClass , destinatio...
Thrown when the source field is null in a mapping of nested type .
23,746
public static void bodyContainsIllegalCode ( Method method , Exception additionalInformation ) { Class < ? > clazz = method . getClazz ( ) ; if ( isNull ( clazz ) ) clazz = JMapper . class ; String originalName = method . getOriginalName ( ) ; if ( isNull ( originalName ) ) originalName = method . getName ( ) ; String ...
Thrown when the code contained in the body method is illegal .
23,747
public static void incorrectMethodDefinition ( String methodName , String className ) { throw new DynamicConversionMethodException ( MSG . INSTANCE . message ( dynamicConversionMethodException , methodName , className ) ) ; }
Thrown when the method don t respects the convetions beloging to the dynamic conversion implementation .
23,748
public static void incorrectBodyDefinition ( String methodName , String className ) { throw new DynamicConversionBodyException ( MSG . INSTANCE . message ( dynamicConversionBodyException , methodName , className ) ) ; }
Thrown when the body method don t respects the convetions beloging to the dynamic conversion implementation .
23,749
public static void attributeInexistent ( String attributeName , Class < ? > aClass ) { throw new IllegalArgumentException ( MSG . INSTANCE . message ( malformedBeanException2 , attributeName , aClass . getSimpleName ( ) ) ) ; }
Thrown if attributes isn t present in the xml file .
23,750
public static void xmlWrongMethod ( Class < ? > aClass ) { throw new WrongMethodException ( MSG . INSTANCE . message ( wrongMethodException1 , aClass . getSimpleName ( ) ) ) ; }
Thrown when the class has only one attribute .
23,751
public static void xmlClassInexistent ( String path , Class < ? > aClass ) { throw new XmlMappingClassDoesNotExistException ( MSG . INSTANCE . message ( xmlMappingClassDoesNotExistException1 , path , aClass . getSimpleName ( ) ) ) ; }
Thrown if class isn t present in xml file .
23,752
public static void xmlClassExistent ( String path , Class < ? > aClass ) { throw new XmlMappingClassExistException ( MSG . INSTANCE . message ( xmlMappingClassExistException1 , aClass . getSimpleName ( ) , path ) ) ; }
Thrown if class is present in xml file .
23,753
public static void xmlConversionNameUndefined ( String xmlPath , String className ) { throw new XmlConversionNameException ( MSG . INSTANCE . message ( xmlConversionNameException , xmlPath , className ) ) ; }
Thrown when the conversion name is undefined .
23,754
public static void xmlConversionTypeIncorrect ( String conversionName , String xmlPath , String className , String type ) { throw new XmlConversionTypeException ( MSG . INSTANCE . message ( xmlConversionTypeException , conversionName , xmlPath , className , type ) ) ; }
Thrown if conversion type is wrong .
23,755
public static void improperUseOfTheParameter ( String conversionName , String xmlPath , String className ) { throw new XmlConversionParameterException ( MSG . INSTANCE . message ( xmlConversionParameterException , conversionName , xmlPath , className ) ) ; }
Thrown if the use of the parameters is incorrect .
23,756
public static void undefinedMapping ( Field destinationField , Class < ? > destinationClass , Field sourceField , Class < ? > sourceClass ) { throw new UndefinedMappingException ( MSG . INSTANCE . message ( undefinedMappingException , destinationField . getName ( ) , destinationClass . getSimpleName ( ) , sourceField ....
Thrown when the instruction isn t defined .
23,757
public static void badConversion ( Field destinationField , Class < ? > destinationClass , Field sourceField , Class < ? > sourceClass , String plus ) { throw new UndefinedMappingException ( MSG . INSTANCE . message ( undefinedMappingException , destinationField . getName ( ) , destinationClass . getSimpleName ( ) , so...
Thrown when conversions are badly written .
23,758
public static void mapping ( String mappedFieldName , Class < ? > mappedClass , Class < ? > targetClass ) { throw new MappingErrorException ( MSG . INSTANCE . message ( mappingErrorException2 , mappedFieldName , mappedClass . getSimpleName ( ) , targetClass . getSimpleName ( ) ) ) ; }
Thrown when there is an error in the configuration .
23,759
public static void mapping ( String mappedFieldName , String mappedClassName ) { throw new MappingErrorException ( MSG . INSTANCE . message ( mappingErrorException2length , mappedFieldName , mappedClassName ) ) ; }
Thrown when the length of classes and attribute parameter isn t the same .
23,760
public static void mapping ( String mappedFieldName , String mappedClassName , String targetClassName ) { throw new MappingErrorException ( MSG . INSTANCE . message ( mappingErrorException3 , mappedFieldName , mappedClassName , targetClassName ) ) ; }
Thrown when the target class doesn t exist in classes parameter .
23,761
public static void attributeAbsent ( Class < ? > aClass , Attribute aField ) { throw new XmlMappingAttributeDoesNotExistException ( MSG . INSTANCE . message ( xmlMappingAttributeDoesNotExistException2 , aField . getName ( ) , aClass . getSimpleName ( ) , "API" ) ) ; }
Thrown if the attribute doesn t exist in aClass .
23,762
public static void configNotPresent ( Class < ? > destination , Class < ? > source , XML xml ) { throw new MappingNotFoundException ( MSG . INSTANCE . message ( Constants . mappingNotFoundException2path , destination . getSimpleName ( ) , source . getSimpleName ( ) , xml . getXmlPath ( ) ) ) ; }
Thrown when the xml configuration doesn t contains the classes configuration .
23,763
public static void configNotPresent ( Class < ? > clazz , XML xml ) { throw new MappingNotFoundException ( MSG . INSTANCE . message ( Constants . mappingNotFoundException1path , clazz . getSimpleName ( ) , xml . getXmlPath ( ) ) ) ; }
Thrown when missing the configuration belonging to clazz .
23,764
public static void classesNotConfigured ( Class < ? > destination , Class < ? > source ) { throw new MappingNotFoundException ( MSG . INSTANCE . message ( Constants . mappingNotFoundException2 , destination . getSimpleName ( ) , source . getSimpleName ( ) ) ) ; }
Thrown when the xml configuration doesn t exist .
23,765
public static void classNotConfigured ( Class < ? > clazz ) { throw new MappingNotFoundException ( MSG . INSTANCE . message ( Constants . mappingNotFoundException1 , clazz . getSimpleName ( ) ) ) ; }
Thrown when the xml configuration of the clazz doesn t exist .
23,766
public static void globalClassesAbsent ( Class < ? > aClass ) { throw new MappingErrorException ( MSG . INSTANCE . message ( mappingErrorRelationalException3 , aClass . getSimpleName ( ) ) ) ; }
Thrown if the configured class hasn t classes parameter .
23,767
public static void classesAbsent ( String fieldName , Class < ? > aClass ) { throw new MappingErrorException ( MSG . INSTANCE . message ( mappingErrorRelationalException2 , fieldName , aClass . getSimpleName ( ) ) ) ; }
Thrown if the configured field hasn t classes parameter .
23,768
public static void classNotMapped ( Class < ? > aClass ) { throw new ClassNotMappedException ( MSG . INSTANCE . message ( classNotMappedException1 , aClass . getSimpleName ( ) ) ) ; }
Thrown if the class isn t mapped .
23,769
public static void classNotMapped ( Object sourceClass , Class < ? > configuredClass ) { String sourceName = sourceClass instanceof Class ? ( ( Class < ? > ) sourceClass ) . getSimpleName ( ) : sourceClass . getClass ( ) . getSimpleName ( ) ; throw new ClassNotMappedException ( MSG . INSTANCE . message ( classNotMapped...
Thrown if the sourceClass isn t mapped in configuredClass .
23,770
public static void illegalCode ( Class < ? > destination , Class < ? > source , String path , Throwable e ) { String additionalInformation = e . getMessage ( ) . split ( "," ) [ 1 ] ; throw new IllegalCodeException ( MSG . INSTANCE . message ( illegalCodePath , destination . getSimpleName ( ) , source . getSimpleName (...
Thrown when there is an error in mapper generated class .
23,771
public static void absentRelationship ( Class < ? > configuredClass , Class < ? > targetClass ) { throw new AbsentRelationshipException ( MSG . INSTANCE . message ( noRelationshipException , configuredClass . getSimpleName ( ) , targetClass . getSimpleName ( ) ) ) ; }
Thrown when there isn t correspondence between classes .
23,772
public static void emptyConstructorAbsent ( Class < ? > aClass ) { throw new MalformedBeanException ( MSG . INSTANCE . message ( malformedBeanException1 , aClass . getSimpleName ( ) ) ) ; }
Thrown if the class haven t an empty constructor .
23,773
protected ChooseConfig searchConfig ( ChooseConfig cc , XML xml ) { ChooseConfig config = searchXmlConfig ( cc , xml ) ; if ( isNull ( config ) ) config = searchAnnotatedConfig ( cc ) ; return config ; }
This method finds the configuration location returns null if don t finds it
23,774
private ChooseConfig searchXmlConfig ( ChooseConfig cc , XML xml ) { if ( isNull ( xml . getXmlPath ( ) ) ) return null ; if ( ( isNull ( cc ) || cc == ChooseConfig . DESTINATION ) && xml . isInheritedMapped ( destination ) ) return ChooseConfig . DESTINATION ; if ( ( isNull ( cc ) || cc == ChooseConfig . SOURCE ) && x...
This method finds the xml configuration returns null if there are no .
23,775
private ChooseConfig searchAnnotatedConfig ( ChooseConfig cc ) { if ( ( isNull ( cc ) || cc == ChooseConfig . DESTINATION ) && Annotation . isInheritedMapped ( destination ) ) return ChooseConfig . DESTINATION ; if ( ( isNull ( cc ) || cc == ChooseConfig . SOURCE ) && Annotation . isInheritedMapped ( source ) ) return ...
This method finds the annotations returns null if there are no .
23,776
public static JMapAccessor getFieldAccessors ( Class < ? > clazz , Field field ) { return getFieldAccessors ( clazz , field , false , field . getName ( ) , Constants . DEFAULT_FIELD_VALUE ) ; }
Returns JMapAccessor relative to this field null if not present .
23,777
private static JMapAccessor getAccessor ( Class < ? > clazz , java . lang . annotation . Annotation [ ] annotations , String fieldName , boolean isOpposite ) { for ( java . lang . annotation . Annotation annotation : annotations ) { if ( annotation . annotationType ( ) == JMapAccessors . class ) { JMapAccessors jmapAcc...
It finds between annotations if exists a JMapAccessor relative to the field with this name .
23,778
public static List < ConversionMethod > getConversionMethods ( Class < ? > clazz ) { List < ConversionMethod > conversions = new ArrayList < ConversionMethod > ( ) ; for ( Method method : getAnnotatedMethods ( clazz ) ) try { conversions . add ( Converter . toConversionMethod ( method ) ) ; } catch ( ConversionParamete...
Returns a list of ConversionMethod that belong to the class given as input .
23,779
private static List < Method > getAnnotatedMethods ( Class < ? > clazz ) { List < Method > methods = new ArrayList < Method > ( ) ; for ( Method method : getAllMethods ( clazz ) ) if ( ! isNull ( method . getAnnotation ( JMapConversion . class ) ) ) methods . add ( method ) ; return methods ; }
Returns a list with all annotated methods .
23,780
public static boolean isInheritedMapped ( Class < ? > classToCheck ) { for ( Class < ? > clazz : getAllsuperClasses ( classToCheck ) ) if ( ! isNull ( clazz . getAnnotation ( JGlobalMap . class ) ) ) return true ; for ( Field field : getListOfFields ( classToCheck ) ) if ( ! isNull ( field . getAnnotation ( JMap . clas...
Returns true if the class is configured in annotation false otherwise .
23,781
public static ConversionType getConversionType ( final Field destination , final Field source ) { return getConversionType ( destination . getType ( ) , source . getType ( ) ) ; }
Analyzes Fields given as input and returns the type of conversion that has to be done .
23,782
public static ConversionType getConversionType ( final Class < ? > destination , final Class < ? > source ) { if ( destination == String . class ) return toStringConversion ( source ) ; if ( destination == Byte . class ) return toByteConversion ( source ) ; if ( destination == byte . class ) return tobyteConversion ( s...
Analyzes classes given as input and returns the type of conversion that has to be done .
23,783
private Class < ? > defineStructure ( Field destination , Field source ) { Class < ? > destinationClass = destination . getType ( ) ; Class < ? > sourceClass = source . getType ( ) ; Class < ? > result = null ; if ( destinationClass . isInterface ( ) ) if ( sourceClass . isInterface ( ) ) result = ( Class < ? > ) imple...
This method defines the destination structure for this operation . If destination class is an interface a relative implementation will be found .
23,784
public static < D , S > IJMapper < D , S > getMapper ( final Class < D > destination , final Class < S > source ) { return getMapper ( destination , source , undefinedConfig ( ) ) ; }
Returns an instance of JMapper from cache if exists in alternative a new instance .
23,785
private static String relationalMapperName ( Class < ? > configuredClass , String resource ) { String className = configuredClass . getName ( ) . replaceAll ( "\\." , "" ) ; if ( isEmpty ( resource ) ) return className ; if ( ! isPath ( resource ) ) return write ( className , String . valueOf ( resource . hashCode ( ) ...
Returns a unique name that identify this relationalMapper .
23,786
public static Attribute attribute ( String name , String customGet , String customSet ) { return new Attribute ( name , customGet , customSet ) ; }
Permits to define an attribute to map .
23,787
public static TargetAttribute targetAttribute ( String name , String customGet , String customSet ) { return new TargetAttribute ( name , customGet , customSet ) ; }
Permits to define a target attribute .
23,788
public static LocalAttribute localAttribute ( String name , String customGet , String customSet ) { return new LocalAttribute ( name , customGet , customSet ) ; }
Permits to define a local attribute .
23,789
public static void error ( Throwable e ) throws JMapperException { logger . error ( "{}: {}" , e . getClass ( ) . getSimpleName ( ) , e . getMessage ( ) ) ; throw new JMapperException ( e ) ; }
This method handles error log .
23,790
protected final StringBuilder write ( StringBuilder sb , final Object ... objects ) { for ( Object string : objects ) sb . append ( string ) ; return sb ; }
This method adds to the sb the objects .
23,791
public Method loadMethod ( ) { methodToGenerate = new Method ( ) ; membership = Membership . MAPPER ; methodToGenerate . setClazz ( configClass ) ; Class < ? > destinationClass = destinationField . getType ( ) ; Class < ? > sourceClass = sourceField . getType ( ) ; methodToGenerate . setReturnType ( destinationClass ) ...
Loads the method to generate .
23,792
private String defaultPrimitiveValue ( Class < ? > clazz ) { return clazz == byte . class || clazz == short . class || clazz == int . class ? "0" : clazz == long . class ? "0L" : clazz == float . class ? "0.0f" : clazz == double . class ? "0.0d" : clazz == char . class ? "'\u0000'" : clazz == boolean . class ? "false" ...
Returns the default values of primitive types in the form of strings .
23,793
private String error ( ) { Map < String , List < ConversionMethod > > conversions = xml . conversionsLoad ( ) ; String methodName = "illegalCode" ; String paramater = "" ; String resource = xml . getXmlPath ( ) ; if ( ! isNull ( resource ) ) { boolean isPath = isPath ( resource ) ; methodName = ! isPath ? "illegalCodeC...
This method surrounds the explicit conversion defined with a try - catch to handle null pointers .
23,794
public ConversionHandler load ( ConversionAnalyzer analyzer ) { this . methodDefined = analyzer . getMethod ( ) ; this . membership = analyzer . getMembership ( ) ; this . configClass = membership == Membership . DESTINATION ? destinationClass : sourceClass ; this . configurationType = analyzer . getConfigurationType (...
Loads analyzer configurations
23,795
public ConversionHandler from ( MappedField sourceMappedField ) { this . sourceField = sourceMappedField . getValue ( ) ; placeholders . put ( sourceTypePattern , sourceField . getType ( ) . getName ( ) ) ; placeholders . put ( sourceNamePattern , sourceField . getName ( ) ) ; placeholders . put ( sourceGetPattern , so...
Source field definition .
23,796
public ConversionHandler to ( MappedField destinationMappedField ) { this . destinationField = destinationMappedField . getValue ( ) ; placeholders . put ( destinationTypePattern , destinationField . getType ( ) . getName ( ) ) ; placeholders . put ( destinationNamePattern , destinationField . getName ( ) ) ; placehold...
Destination field definition .
23,797
private static synchronized < D , S > IMapper < D , S > createMapper ( MapperBuilder mapper ) throws Throwable { Class < Mapper < D , S > > mapperClass = mapper . exist ( ) ? mapper . < D , S > get ( ) : mapper . < D , S > generate ( ) ; return mapperClass . newInstance ( ) ; }
This method is synchornized to avoid creations of the same instance
23,798
public JMapper < D , S > destinationFactory ( DestinationFactory < D > factory ) { this . mapper . setDestinationFactory ( factory ) ; return this ; }
Permits to define a destination factory this is usefull in case of immutable objects .
23,799
public static boolean isAssignableFrom ( Class < ? > destination , Class < ? > source ) { return destination . isAssignableFrom ( source ) || isBoxing ( destination , source ) || isUnBoxing ( destination , source ) ; }
Returns true if destination is assignable from source analyzing autoboxing also .