Enum MethodFilter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<MethodFilter>

    public enum MethodFilter
    extends java.lang.Enum<MethodFilter>
    A filter for annotated methods. Used internally to exclude setters or getters from the list of fields to be processed, accordingly to the use case: when parsing into beans, only setter methods are to be considered. When writing values in beans to an output, only the getter methods should be used.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static interface  MethodFilter.Filter  
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ONLY_GETTERS
      Rejects any method that returns void or has a parameter list.
      ONLY_SETTERS
      Rejects any method that doesn't accept a single parameter.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean reject​(java.lang.reflect.Method method)
      Tests whether a method is not a getter or setter and should be rejected.
      MethodDescriptor toDescriptor​(java.lang.String prefix, java.lang.reflect.Method method)
      Creates a descriptor for a getter or setter method
      static MethodFilter valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static MethodFilter[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • ONLY_GETTERS

        public static final MethodFilter ONLY_GETTERS
        Rejects any method that returns void or has a parameter list.
      • ONLY_SETTERS

        public static final MethodFilter ONLY_SETTERS
        Rejects any method that doesn't accept a single parameter.
    • Method Detail

      • values

        public static MethodFilter[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (MethodFilter c : MethodFilter.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static MethodFilter valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • reject

        public boolean reject​(java.lang.reflect.Method method)
        Tests whether a method is not a getter or setter and should be rejected.
        Parameters:
        method - the method to be tested
        Returns:
        true if the given method should be rejected, false otherwise
      • toDescriptor

        public MethodDescriptor toDescriptor​(java.lang.String prefix,
                                             java.lang.reflect.Method method)
        Creates a descriptor for a getter or setter method
        Parameters:
        prefix - a dot separated string denoting a path of nested object names
        method - a actual class method to be associated with this prefix
        Returns:
        a descriptor for the given method