Package org.bremersee.comparator
Class DefaultValueExtractor
java.lang.Object
org.bremersee.comparator.DefaultValueExtractor
- All Implemented Interfaces:
ValueExtractor
The default value extractor supports field names and paths as described in
SortOrder. A field name can be just the field name (for example
firstName), a method name, that is not generated by ValueExtractor.getPossibleMethodNames(String) (for example toString) or a path of field
names separated by dots (.), for example person.firstName.- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new default value extractor that will throwValueExtractorException, if the given field cannot be found.DefaultValueExtractor(boolean throwingException) Instantiates a new default value extractor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bremersee.comparator.ValueExtractor
findField, findField, findMethod, findMethod, getPossibleMethodNames, invoke, invoke
-
Constructor Details
-
DefaultValueExtractor
public DefaultValueExtractor()Instantiates a new default value extractor that will throwValueExtractorException, if the given field cannot be found. -
DefaultValueExtractor
public DefaultValueExtractor(boolean throwingException) Instantiates a new default value extractor.- Parameters:
throwingException- iftrueand the given field cannot be found,ValueExtractorExceptionwill be thrown; otherwisenullwill be returned
-
-
Method Details
-
findValue
Description copied from interface:ValueExtractorFind the value of the given add name or path of the given object.- Specified by:
findValuein interfaceValueExtractor- Parameters:
obj- the objectfieldPath- the field name or path- Returns:
- the object
-