Enum MethodFilter
- java.lang.Object
-
- java.lang.Enum<MethodFilter>
-
- com.univocity.parsers.annotations.helpers.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 returnsvoid
or has a parameter list.ONLY_SETTERS
Rejects any method that doesn't accept a single parameter.
-
Field Summary
Fields Modifier and Type Field Description private MethodFilter.Filter
filter
-
Constructor Summary
Constructors Modifier Constructor Description private
MethodFilter(MethodFilter.Filter filter)
-
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 methodstatic 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.
-
-
-
Enum Constant Detail
-
ONLY_GETTERS
public static final MethodFilter ONLY_GETTERS
Rejects any method that returnsvoid
or has a parameter list.
-
ONLY_SETTERS
public static final MethodFilter ONLY_SETTERS
Rejects any method that doesn't accept a single parameter.
-
-
Field Detail
-
filter
private MethodFilter.Filter filter
-
-
Constructor Detail
-
MethodFilter
private MethodFilter(MethodFilter.Filter filter)
-
-
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 namejava.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 namesmethod
- a actual class method to be associated with this prefix- Returns:
- a descriptor for the given method
-
-