@@ -78,7 +78,7 @@ public enum PrimitiveDefaultValueMode
7878 private final Collection <PropertyPath > excludedProperties = new HashSet <PropertyPath >(10 );
7979 private final Collection <PropertyPath > equalsOnlyProperties = new LinkedHashSet <PropertyPath >(10 );
8080 private final Collection <PropertyPathAndMethod > equalsOnlyValueProviderMethods = new LinkedHashSet <PropertyPathAndMethod >(10 );
81- private final Collection <Class <?>> compareToOnlyTypes = new LinkedHashSet <Class <?>>(10 );
81+ private final Collection <Class <?>> compareToOnlyTypes = new LinkedHashSet <Class <?>>(10 );
8282 private final Collection <Class <?>> equalsOnlyTypes = new LinkedHashSet <Class <?>>(10 );
8383 private final Collection <ClassAndMethod > equalsOnlyValueProviderTypes = new LinkedHashSet <ClassAndMethod >(10 );
8484 private boolean returnUnchangedNodes = false ;
@@ -126,12 +126,12 @@ public Configuration withoutProperty(final PropertyPath propertyPath)
126126 this .excludedProperties .add (propertyPath );
127127 return this ;
128128 }
129-
130- public Configuration withCompareToOnlyType (final Class <?> type )
131- {
132- this .compareToOnlyTypes .add (type );
133- return this ;
134- }
129+
130+ public Configuration withCompareToOnlyType (final Class <?> type )
131+ {
132+ this .compareToOnlyTypes .add (type );
133+ return this ;
134+ }
135135
136136 public Configuration withEqualsOnlyType (final Class <?> type )
137137 {
@@ -145,22 +145,25 @@ public Configuration withEqualsOnlyProperty(final PropertyPath propertyPath)
145145 return this ;
146146 }
147147
148- public Configuration withEqualsOnlyValueProviderMethod (final PropertyPath propertyPath , final String methodName ) {
148+ public Configuration withEqualsOnlyValueProviderMethod (final PropertyPath propertyPath ,
149+ final String methodName )
150+ {
149151 this .equalsOnlyValueProviderMethods .add (new PropertyPathAndMethod (propertyPath , methodName ));
150152 return this ;
151153 }
152-
153- public Configuration withEqualsOnlyValueProviderMethod (PropertyPathAndMethod propertyPathEqualsMethod ) {
154+
155+ public Configuration withEqualsOnlyValueProviderMethod (final PropertyPathAndMethod propertyPathEqualsMethod )
156+ {
154157 this .equalsOnlyValueProviderMethods .add (propertyPathEqualsMethod );
155158 return this ;
156159 }
157-
160+
158161 public Configuration withIgnoredNodes ()
159162 {
160163 this .returnIgnoredNodes = true ;
161164 return this ;
162165 }
163-
166+
164167 public Configuration withoutIgnoredNodes ()
165168 {
166169 this .returnIgnoredNodes = false ;
@@ -331,22 +334,24 @@ public boolean isEqualsOnly(final Node node)
331334 }
332335 return false ;
333336 }
334-
335- public boolean hasEqualsOnlyValueProviderMethod (Node node ){
336- return getEqualsOnlyValueProviderMethod (node ) != null ;
337+
338+ public boolean hasEqualsOnlyValueProviderMethod (final Node node )
339+ {
340+ return Strings .hasText (getEqualsOnlyValueProviderMethod (node ));
337341 }
338-
339- public String getEqualsOnlyValueProviderMethod (Node node ){
342+
343+ public String getEqualsOnlyValueProviderMethod (final Node node )
344+ {
340345 final Class <?> propertyType = node .getType ();
341346 if (propertyType != null )
342347 {
343- ObjectDiffEqualsOnlyValueProvidedType annotation = propertyType .getAnnotation (ObjectDiffEqualsOnlyValueProvidedType .class );
348+ final ObjectDiffEqualsOnlyType annotation = propertyType .getAnnotation (ObjectDiffEqualsOnlyType .class );
344349 if (annotation != null )
345350 {
346- return annotation .method ();
351+ return annotation .valueProviderMethod ();
347352 }
348-
349- ClassAndMethod applicable = findEqualsOnlyValueProviderMethodForClass (propertyType );
353+
354+ final ClassAndMethod applicable = findEqualsOnlyValueProviderMethodForClass (propertyType );
350355 if (applicable != null )
351356 {
352357 return applicable .getMethod ();
@@ -356,27 +361,33 @@ public String getEqualsOnlyValueProviderMethod(Node node){
356361 {
357362 return node .getEqualsOnlyValueProviderMethod ();
358363 }
359- PropertyPathAndMethod applicable = findEqualsOnlyValueProviderMethodForPath (node .getPropertyPath ());
364+ final PropertyPathAndMethod applicable = findEqualsOnlyValueProviderMethodForPath (node .getPropertyPath ());
360365 if (applicable != null )
361366 {
362367 return applicable .getMethod ();
363368 }
364369 return null ;
365370 }
366-
367- private ClassAndMethod findEqualsOnlyValueProviderMethodForClass (Class <?> clazz ){
368- for (ClassAndMethod propertyPathEqualsOnValueProviderType : equalsOnlyValueProviderTypes ){
369- if (clazz .equals (propertyPathEqualsOnValueProviderType .getClazz ())){
371+
372+ private ClassAndMethod findEqualsOnlyValueProviderMethodForClass (final Class <?> clazz )
373+ {
374+ for (final ClassAndMethod propertyPathEqualsOnValueProviderType : equalsOnlyValueProviderTypes )
375+ {
376+ if (clazz .equals (propertyPathEqualsOnValueProviderType .getClazz ()))
377+ {
370378 return propertyPathEqualsOnValueProviderType ;
371379 }
372380 }
373381 return null ;
374-
382+
375383 }
376-
377- private PropertyPathAndMethod findEqualsOnlyValueProviderMethodForPath (PropertyPath propertyPath ){
378- for (PropertyPathAndMethod propertyPathEqualsOnValueProviderMethod : equalsOnlyValueProviderMethods ){
379- if (propertyPath .equals (propertyPathEqualsOnValueProviderMethod .getPropertyPath ())){
384+
385+ private PropertyPathAndMethod findEqualsOnlyValueProviderMethodForPath (final PropertyPath propertyPath )
386+ {
387+ for (final PropertyPathAndMethod propertyPathEqualsOnValueProviderMethod : equalsOnlyValueProviderMethods )
388+ {
389+ if (propertyPath .equals (propertyPathEqualsOnValueProviderMethod .getPropertyPath ()))
390+ {
380391 return propertyPathEqualsOnValueProviderMethod ;
381392 }
382393 }
0 commit comments