Modifier and Type | Field and Description |
---|---|
static String |
CLASSIFICATION_KEY
Classification key path.
|
static String |
CLASSIFICATION_TEMPLATE_KEY
Specifies the classification template key.
|
static int |
DEFAULT_LIMIT
The default limit of entries per response.
|
static String |
DEFAULT_METADATA_TYPE
Specifies the name of the default "properties" metadata template.
|
static String |
ENTERPRISE_METADATA_SCOPE
Specifies the "enterprise" metadata scope.
|
static URLTemplate |
GET_ALL_METADATA_URL_TEMPLATE
URL template for all metadata associated with item.
|
static String |
GLOBAL_METADATA_SCOPE
Specifies the "global" metadata scope.
|
Constructor and Description |
---|
Metadata()
Creates an empty metadata.
|
Metadata(JsonObject values)
Creates a new metadata.
|
Metadata(Metadata other)
Creates a copy of another metadata.
|
Metadata(String scope,
String template)
Creates a new metadata with the specified scope and template.
|
Modifier and Type | Method and Description |
---|---|
Metadata |
add(String path,
float value)
Adds a new metadata value.
|
Metadata |
add(String path,
List<String> values)
Adds a new metadata value of array type.
|
Metadata |
add(String path,
String value)
Adds a new metadata value.
|
String |
get(String path)
Deprecated.
Metadata#get() does not handle all possible metadata types; use Metadata#getValue() instead
|
static Iterable<Metadata> |
getAllMetadata(BoxItem item,
String... fields)
Used to retrieve all metadata associated with the item.
|
Date |
getDate(String path)
Get a value from a date metadata field.
|
double |
getFloat(String path)
Get a value from a float metadata field.
|
String |
getID()
Returns the 36 character UUID to identify the metadata object.
|
List<String> |
getMultiSelect(String path)
Get a value from a multiselect metadata field.
|
JsonArray |
getOperations()
Returns an array of operations on metadata.
|
String |
getParentID()
Returns the parent object ID (typically the file ID).
|
String |
getPatch()
Returns the JSON patch string with all operations.
|
List<String> |
getPropertyPaths()
Returns a list of metadata property paths.
|
String |
getScope()
Returns the scope.
|
String |
getString(String path)
Get a value from a string or enum metadata field.
|
String |
getTemplateName()
Returns the template name.
|
String |
getTypeName()
Returns the metadata type.
|
JsonValue |
getValue(String path)
Returns a value, regardless of type.
|
Metadata |
remove(String path)
Removes an existing metadata value.
|
Metadata |
replace(String path,
float value)
Replaces an existing metadata value.
|
Metadata |
replace(String path,
List<String> values)
Replaces an existing metadata value of array type.
|
Metadata |
replace(String path,
String value)
Replaces an existing metadata value.
|
Metadata |
test(String path,
List<String> values)
Tests that a list of properties has the expected value.
|
Metadata |
test(String path,
String value)
Tests that a property has the expected value.
|
String |
toString()
Returns the JSON representation of this metadata.
|
public static final String DEFAULT_METADATA_TYPE
public static final String GLOBAL_METADATA_SCOPE
public static final String ENTERPRISE_METADATA_SCOPE
public static final String CLASSIFICATION_TEMPLATE_KEY
public static final String CLASSIFICATION_KEY
public static final int DEFAULT_LIMIT
public static final URLTemplate GET_ALL_METADATA_URL_TEMPLATE
public Metadata()
public Metadata(JsonObject values)
values
- the initial metadata values.public Metadata(Metadata other)
other
- the other metadata object to copy.public static Iterable<Metadata> getAllMetadata(BoxItem item, String... fields)
item
- item to get metadata for.fields
- the optional fields to retrieve.public String getID()
public String getTypeName()
public String getParentID()
public String getTemplateName()
public Metadata add(String path, String value)
path
- the path that designates the key. Must be prefixed with a "/".value
- the value.public Metadata add(String path, float value)
path
- the path that designates the key. Must be prefixed with a "/".value
- the value.public Metadata add(String path, List<String> values)
path
- the path to the field.values
- the collection of values.public Metadata replace(String path, String value)
path
- the path that designates the key. Must be prefixed with a "/".value
- the value.public Metadata replace(String path, float value)
path
- the path that designates the key. Must be prefixed with a "/".value
- the value.public Metadata replace(String path, List<String> values)
path
- the path that designates the key. Must be prefixed with a "/".values
- the collection of values.public Metadata remove(String path)
path
- the path that designates the key. Must be prefixed with a "/".public Metadata test(String path, String value)
path
- the path that designates the key. Must be prefixed with a "/".value
- the expected value.public Metadata test(String path, List<String> values)
path
- the path that designates the key. Must be prefixed with a "/".values
- the list of expected values.@Deprecated public String get(String path)
path
- the path that designates the key. Must be prefixed with a "/".public JsonValue getValue(String path)
path
- the path that designates the key. Must be prefixed with a "/".public String getString(String path)
path
- the key path in the metadata object. Must be prefixed with a "/".public double getFloat(String path)
path
- the key path in the metadata object. Must be prefixed with a "/".public Date getDate(String path) throws ParseException
path
- the key path in the metadata object. Must be prefixed with a "/".ParseException
- when the value cannot be parsed as a valid datepublic List<String> getMultiSelect(String path)
path
- the key path in the metadata object. Must be prefixed with a "/".public List<String> getPropertyPaths()
public String getPatch()
public JsonArray getOperations()