Class DefaultValueExtractor

  • All Implemented Interfaces:
    ValueExtractor

    public class DefaultValueExtractor
    extends Object
    implements 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 Detail

      • DefaultValueExtractor

        public DefaultValueExtractor()
        Instantiates a new default value extractor that will throw ValueExtractorException, if the given field cannot be found.
      • DefaultValueExtractor

        public DefaultValueExtractor​(boolean throwingException)
        Instantiates a new default value extractor.
        Parameters:
        throwingException - if true and the given field cannot be found, ValueExtractorException will be thrown; otherwise null will be returned
    • Method Detail

      • findValue

        public Object findValue​(Object obj,
                                String fieldPath)
        Description copied from interface: ValueExtractor
        Find the value of the given add name or path of the given object.
        Specified by:
        findValue in interface ValueExtractor
        Parameters:
        obj - the object
        fieldPath - the field name or path
        Returns:
        the object