public enum JsonMethod extends Enum<JsonMethod>
JsonAutoDetect
apply to.
In addition to actual method types (GETTER, SETTER, CREATOR; and
sort-of-method, FIELD), 2 pseudo-types
are defined for convenience: ALWAYS
and NONE
. These
can be used to indicate, all or none of available method types (respectively),
for use by annotations that takes JsonMethod
argument.
枚举常量和说明 |
---|
ALL
This pseudo-type indicates that all of real types are included
|
CREATOR
Creators are constructors and (static) factory methods used to
construct POJO instances for deserialization
|
FIELD
Field refers to fields of regular Java objects.
|
GETTER
Getters are methods used to get a POJO field value for serialization,
or, under certain conditions also for de-serialization.
|
IS_GETTER
"Is getters" are getter-like methods that are named "isXxx"
(instead of "getXxx" for getters) and return boolean value
(either primitive, or
Boolean ). |
NONE
This pseudo-type indicates that none of real types is included
|
SETTER
Setters are methods used to set a POJO value for deserialization.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
creatorEnabled() |
boolean |
fieldEnabled() |
boolean |
getterEnabled() |
boolean |
isGetterEnabled() |
boolean |
setterEnabled() |
static JsonMethod |
valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static JsonMethod[] |
values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
public static final JsonMethod GETTER
Since version 1.3, this does NOT include "is getters" (methods
that return boolean and named 'isXxx' for property 'xxx'); instead,
IS_GETTER
is used}.
public static final JsonMethod SETTER
public static final JsonMethod CREATOR
public static final JsonMethod FIELD
public static final JsonMethod IS_GETTER
Boolean
).public static final JsonMethod NONE
public static final JsonMethod ALL
public static JsonMethod[] values()
for (JsonMethod c : JsonMethod.values()) System.out.println(c);
public static JsonMethod valueOf(String name)
name
- 要返回的枚举常量的名称。如果该枚举类型没有带有指定名称的常量,
- 则抛出 IllegalArgumentException如果参数为空值,
- 则抛出 NullPointerExceptionpublic boolean creatorEnabled()
public boolean getterEnabled()
public boolean isGetterEnabled()
public boolean setterEnabled()
public boolean fieldEnabled()