public enum ValueExistencePolicy extends Enum<ValueExistencePolicy>
MetadataStandard.asValueMap(…)
shall contain entries for null,
nil or empty values. By default the value map does not provide
entries for null
metadata properties, nil objects or
empty collections.
This enumeration allows to control this behavior.
null
in the Java sense.
Null references can be used for missing properties when no information is provided about why the property is missing.
On the other hand, a nil object is a placeholder for a missing property similar in purpose to null
references,
except that an explanation about why the property is missing can be attached to those objects.
Those explanations can be obtained by calls to the NilReason.forObject(Object)
method.MetadataStandard.asValueMap(Object, Class, KeyNamePolicy, ValueExistencePolicy)
Defined in the sis-metadata
module
Enum Constant and Description |
---|
ALL
Includes all entries in the map, including those having a null value or an empty collection.
|
COMPACT
Includes non-empty properties but omits title properties.
|
NON_EMPTY
Includes only the properties that are non-null, non-nil and non empty.
|
NON_NIL
Includes only the non-null and non-nil properties.
|
NON_NULL
Includes only the non-null properties.
|
Modifier and Type | Method and Description |
---|---|
static ValueExistencePolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ValueExistencePolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ValueExistencePolicy ALL
public static final ValueExistencePolicy NON_NULL
NilObject
s are included.
Collections are included no matter if they are empty or not.
The set of NON_NULL
properties is a subset of ALL
properties.
public static final ValueExistencePolicy NON_NIL
The set of NON_NIL
properties is a subset of NON_NULL
properties.
public static final ValueExistencePolicy NON_EMPTY
AbstractMetadata.asMap()
.
The set of NON_EMPTY
properties is a subset of NON_NIL
properties.
public static final ValueExistencePolicy COMPACT
TitleProperty
;
for all other classes, this policy is identical to NON_EMPTY
.
DefaultCitation
and
DefaultCitationDate
classes are annotated with
@TitleProperty(name="title")
and @TitleProperty(name="date")
respectively. The following table compares the trees produced by two policies:
NON_EMPTY |
COMPACT |
---|---|
Citation ├─Title……………………… My document └─Date ├─Date………………… 2012/01/01 └─Date type…… Creation |
Citation……………………… My document └─Date………………………… 2012/01/01 └─Date type…… Creation |
AbstractMetadata.asTreeTable()
,
and consequently defines the default rendering of AbstractMetadata.toString()
.TitleProperty
public static ValueExistencePolicy[] values()
for (ValueExistencePolicy c : ValueExistencePolicy.values()) System.out.println(c);
public static ValueExistencePolicy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2010–2017 The Apache Software Foundation. All rights reserved.