#122 Minor formatting changes

This commit is contained in:
navpil 2017-05-10 15:11:18 +03:00 committed by Filip Hrisafov
parent 5dd0097cc9
commit 75fa2fb0f7
2 changed files with 19 additions and 13 deletions

View File

@ -102,7 +102,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
return setupMethodWithMapping( sourceMethod ); return setupMethodWithMapping( sourceMethod );
} }
public Builder forgedMethod(Method method ) { public Builder forgedMethod(Method method) {
singleMapping = new EmptySingleMapping(); singleMapping = new EmptySingleMapping();
return setupMethodWithMapping( method ); return setupMethodWithMapping( method );
} }
@ -206,7 +206,8 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
method, method,
selectionParameters, selectionParameters,
ctx, ctx,
existingVariableNames ); existingVariableNames
);
List<LifecycleCallbackMethodReference> afterMappingMethods = List<LifecycleCallbackMethodReference> afterMappingMethods =
LifecycleCallbackFactory.afterMappingMethods( method, selectionParameters, ctx, existingVariableNames ); LifecycleCallbackFactory.afterMappingMethods( method, selectionParameters, ctx, existingVariableNames );

View File

@ -127,7 +127,7 @@ public class SourceReference {
if ( segments.length > 1 && parameter != null ) { if ( segments.length > 1 && parameter != null ) {
sourcePropertyNames = Arrays.copyOfRange( segments, 1, segments.length ); sourcePropertyNames = Arrays.copyOfRange( segments, 1, segments.length );
entries = getSourceEntries( parameter.getType(), sourcePropertyNames ); entries = getSourceEntries( parameter.getType(), sourcePropertyNames );
foundEntryMatch = (entries.size() == sourcePropertyNames.length); foundEntryMatch = ( entries.size() == sourcePropertyNames.length );
} }
else { else {
// its only a parameter, no property // its only a parameter, no property
@ -141,14 +141,14 @@ public class SourceReference {
sourcePropertyNames = segments; sourcePropertyNames = segments;
parameter = method.getSourceParameters().get( 0 ); parameter = method.getSourceParameters().get( 0 );
entries = getSourceEntries( parameter.getType(), sourcePropertyNames ); entries = getSourceEntries( parameter.getType(), sourcePropertyNames );
foundEntryMatch = (entries.size() == sourcePropertyNames.length); foundEntryMatch = ( entries.size() == sourcePropertyNames.length );
if ( !foundEntryMatch ) { if ( !foundEntryMatch ) {
//Lets see if the expression contains the parameterName, so parameterName.propName1.propName2 //Lets see if the expression contains the parameterName, so parameterName.propName1.propName2
if ( parameter.getName().equals( segments[0] ) ) { if ( parameter.getName().equals( segments[0] ) ) {
sourcePropertyNames = Arrays.copyOfRange( segments, 1, segments.length ); sourcePropertyNames = Arrays.copyOfRange( segments, 1, segments.length );
entries = getSourceEntries( parameter.getType(), sourcePropertyNames ); entries = getSourceEntries( parameter.getType(), sourcePropertyNames );
foundEntryMatch = (entries.size() == sourcePropertyNames.length); foundEntryMatch = ( entries.size() == sourcePropertyNames.length );
} }
else { else {
// segment[0] cannot be attributed to the parameter name. // segment[0] cannot be attributed to the parameter name.
@ -161,7 +161,8 @@ public class SourceReference {
if ( parameter != null ) { if ( parameter != null ) {
reportMappingError( Message.PROPERTYMAPPING_NO_PROPERTY_IN_PARAMETER, parameter.getName(), reportMappingError( Message.PROPERTYMAPPING_NO_PROPERTY_IN_PARAMETER, parameter.getName(),
Strings.join( Arrays.asList( sourcePropertyNames ), "." ) ); Strings.join( Arrays.asList( sourcePropertyNames ), "." )
);
} }
else { else {
int notFoundPropertyIndex; int notFoundPropertyIndex;
@ -204,10 +205,13 @@ public class SourceReference {
for ( Map.Entry<String, Accessor> getter : sourceReadAccessors.entrySet() ) { for ( Map.Entry<String, Accessor> getter : sourceReadAccessors.entrySet() ) {
if ( getter.getKey().equals( entryName ) ) { if ( getter.getKey().equals( entryName ) ) {
newType = typeFactory.getReturnType( (DeclaredType) newType.getTypeMirror(), newType = typeFactory.getReturnType(
getter.getValue() ); (DeclaredType) newType.getTypeMirror(),
getter.getValue()
);
sourceEntries.add( forSourceReference( entryName, getter.getValue(), sourceEntries.add( forSourceReference( entryName, getter.getValue(),
sourcePresenceCheckers.get( entryName ), newType ) ); sourcePresenceCheckers.get( entryName ), newType
) );
matchFound = true; matchFound = true;
break; break;
} }
@ -221,7 +225,8 @@ public class SourceReference {
private void reportMappingError(Message msg, Object... objects) { private void reportMappingError(Message msg, Object... objects) {
messager.printMessage( method.getExecutable(), mapping.getMirror(), mapping.getSourceAnnotationValue(), messager.printMessage( method.getExecutable(), mapping.getMirror(), mapping.getSourceAnnotationValue(),
msg, objects ); msg, objects
);
} }
} }