#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,9 +102,9 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
return setupMethodWithMapping( sourceMethod );
}
public Builder forgedMethod(Method method ) {
public Builder forgedMethod(Method method) {
singleMapping = new EmptySingleMapping();
return setupMethodWithMapping( method );
return setupMethodWithMapping( method );
}
private Builder setupMethodWithMapping(Method sourceMethod) {
@ -206,7 +206,8 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
method,
selectionParameters,
ctx,
existingVariableNames );
existingVariableNames
);
List<LifecycleCallbackMethodReference> afterMappingMethods =
LifecycleCallbackFactory.afterMappingMethods( method, selectionParameters, ctx, existingVariableNames );
@ -427,7 +428,7 @@ public class BeanMappingMethod extends NormalTypeMappingMethod {
unprocessedSourceParameters.remove( sourceRef.getParameter() );
}
else {
errorOccured = true;
errorOccured = true;
}
}

View File

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