Class ParserUtils


  • public final class ParserUtils
    extends java.lang.Object
    Utility method for getting and setting parameters on Processor Input and Output objects.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.Predicate<java.lang.reflect.Field> FILTER_FINAL_FIELDS
      A filter (for the get attribute methods) that selects only the attributes that are final.
      static java.util.function.Predicate<java.lang.reflect.Field> FILTER_HAS_DEFAULT_ATTRIBUTES
      A filter (for the get attribute methods) that selects only the attributes that are NOT required and excludes all of those that are considered required.
      static java.util.function.Predicate<java.lang.reflect.Field> FILTER_NON_FINAL_FIELDS
      A filter (for the get attribute methods) that selects only the attributes that are non final.
      static java.util.function.Predicate<java.lang.reflect.Field> FILTER_ONLY_REQUIRED_ATTRIBUTES
      A filter (for the get attribute methods) that selects only the attributes that are required and excludes all of those with defaults, and therefore are considered optional.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<java.lang.String> getAllAttributeNames​(java.lang.Class<?> classToInspect)
      Converts all non-final properties in getAllAttributes(Class) to a set of the attribute names.
      static java.util.Collection<java.lang.reflect.Field> getAllAttributes​(java.lang.Class<?> classToInspect)
      Inspects the object and all superclasses for public, non-final, accessible methods and returns a collection containing all the attributes found.
      static java.util.Set<java.lang.String> getAttributeNames​(java.lang.Class<?> classToInspect, java.util.function.Predicate<java.lang.reflect.Field> filter)
      Converts all properties in getAllAttributes(Class) to a set of the attribute names.
      static java.util.Collection<java.lang.reflect.Field> getAttributes​(java.lang.Class<?> classToInspect, java.util.function.Predicate<java.lang.reflect.Field> filter)
      Get a subset of the attributes of the provided class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FILTER_ONLY_REQUIRED_ATTRIBUTES

        public static final java.util.function.Predicate<java.lang.reflect.Field> FILTER_ONLY_REQUIRED_ATTRIBUTES
        A filter (for the get attribute methods) that selects only the attributes that are required and excludes all of those with defaults, and therefore are considered optional.
      • FILTER_HAS_DEFAULT_ATTRIBUTES

        public static final java.util.function.Predicate<java.lang.reflect.Field> FILTER_HAS_DEFAULT_ATTRIBUTES
        A filter (for the get attribute methods) that selects only the attributes that are NOT required and excludes all of those that are considered required.
      • FILTER_NON_FINAL_FIELDS

        public static final java.util.function.Predicate<java.lang.reflect.Field> FILTER_NON_FINAL_FIELDS
        A filter (for the get attribute methods) that selects only the attributes that are non final. (Can be modified)
      • FILTER_FINAL_FIELDS

        public static final java.util.function.Predicate<java.lang.reflect.Field> FILTER_FINAL_FIELDS
        A filter (for the get attribute methods) that selects only the attributes that are final. (Can NOT be modified)
    • Method Detail

      • getAllAttributes

        public static java.util.Collection<java.lang.reflect.Field> getAllAttributes​(java.lang.Class<?> classToInspect)
        Inspects the object and all superclasses for public, non-final, accessible methods and returns a collection containing all the attributes found.
        Parameters:
        classToInspect - the class under inspection.
      • getAttributes

        public static java.util.Collection<java.lang.reflect.Field> getAttributes​(java.lang.Class<?> classToInspect,
                                                                                  java.util.function.Predicate<java.lang.reflect.Field> filter)
        Get a subset of the attributes of the provided class. An attribute is each public field in the class or super class.
        Parameters:
        classToInspect - the class to inspect
        filter - a predicate that returns true when a attribute should be kept in resulting collection.
      • getAllAttributeNames

        public static java.util.Set<java.lang.String> getAllAttributeNames​(java.lang.Class<?> classToInspect)
        Converts all non-final properties in getAllAttributes(Class) to a set of the attribute names.
        Parameters:
        classToInspect - the class to inspect
      • getAttributeNames

        public static java.util.Set<java.lang.String> getAttributeNames​(java.lang.Class<?> classToInspect,
                                                                        java.util.function.Predicate<java.lang.reflect.Field> filter)
        Converts all properties in getAllAttributes(Class) to a set of the attribute names.
        Parameters:
        classToInspect - the class to inspect
        filter - a predicate that returns true when a attribute should be kept in resulting collection.