Enum Class MethodFilter

java.lang.Object
java.lang.Enum<MethodFilter>
com.univocity.parsers.annotations.helpers.MethodFilter
All Implemented Interfaces:
Serializable, Comparable<MethodFilter>, Constable

public enum MethodFilter extends 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.
  • Enum Constant Details

    • 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.
  • Field Details

  • Constructor Details

  • Method Details

    • values

      public static MethodFilter[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MethodFilter valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • reject

      public boolean reject(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(String prefix, 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