public static enum JsonSerialize.Inclusion extends Enum<JsonSerialize.Inclusion>
JsonSerialize.include() property
to define which properties
of Java Beans are to be included in serialization| 枚举常量和说明 |
|---|
ALWAYS
Value that indicates that properties are to be always included,
independent of value
|
NON_DEFAULT
Value that indicates that only properties that have values
that differ from default settings (meaning values they have
when Bean is constructed with its no-arguments constructor)
are to be included.
|
NON_EMPTY
Value that indicates that only properties that have values
that values that are null or what is considered empty are
not to be included.
|
NON_NULL
Value that indicates that only properties with non-null
values are to be included.
|
public static final JsonSerialize.Inclusion ALWAYS
public static final JsonSerialize.Inclusion NON_NULL
public static final JsonSerialize.Inclusion NON_DEFAULT
Maps, since they have no default values;
and if used, works same as ALWAYS.public static final JsonSerialize.Inclusion NON_EMPTY
Collections and Maps,
method isEmpty() is called;
Strings, length() is called,
and return value of 0 indicates empty String (note that String.isEmpty()
was added in Java 1.6 and as such can not be used by Jackson
public static JsonSerialize.Inclusion[] values()
for (JsonSerialize.Inclusion c : JsonSerialize.Inclusion.values()) System.out.println(c);
public static JsonSerialize.Inclusion valueOf(String name)
name - 要返回的枚举常量的名称。如果该枚举类型没有带有指定名称的常量, - 则抛出 IllegalArgumentException如果参数为空值, - 则抛出 NullPointerException