Package com.cloudinary.metadata
Class MetadataField<T>
java.lang.Object
org.cloudinary.json.JSONObject
com.cloudinary.metadata.MetadataField<T>
- Type Parameters:
T-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
DateMetadataField,EnumMetadataField,IntMetadataField,SetMetadataField,StringMetadataField
public class MetadataField<T> extends JSONObject
Represents a single metadata field. Use one of the derived classes in the metadata API calls.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_VALUEstatic java.lang.StringEXTERNAL_IDstatic java.lang.StringLABELstatic java.lang.StringMANDATORYstatic java.lang.StringTYPEstatic java.lang.StringVALIDATION -
Constructor Summary
Constructors Constructor Description MetadataField(MetadataFieldType type)MetadataField(java.lang.String type) -
Method Summary
Modifier and Type Method Description MetadataDataSourcegetDataSource()Get the data source definition of this field.TgetDefaultValue()Gets the default value of this field.java.lang.StringgetExternalId()Get the id of the field.java.lang.StringgetLabel()Get the label of the fieldMetadataFieldTypegetType()The type of the field.MetadataValidationgetValidation()Get the validation rules of this field.booleanisMandatory()Cehcks whether the field is mandatory.voidsetDataSource(MetadataDataSource dataSource)Set the datasource for the field.voidsetDefaultValue(T defaultValue)Set the default value of the fieldvoidsetExternalId(java.lang.String externalId)Set the id of the string (auto-generated if this is left blank).voidsetLabel(java.lang.String label)Sets the label of the fieldvoidsetMandatory(java.lang.Boolean mandatory)Sets a boolean indicating whether this fields needs to be mandatory.voidsetValidation(MetadataValidation validation)Set the validation rules of this field.Methods inherited from class org.cloudinary.json.JSONObject
accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNames, getNames, getString, has, increment, isNull, keys, keySet, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOnce, putOpt, quote, quote, remove, similar, stringToValue, testValidity, toJSONArray, toString, toString, valueToString, wrap, write
-
Field Details
-
DEFAULT_VALUE
public static final java.lang.String DEFAULT_VALUE- See Also:
- Constant Field Values
-
EXTERNAL_ID
public static final java.lang.String EXTERNAL_ID- See Also:
- Constant Field Values
-
LABEL
public static final java.lang.String LABEL- See Also:
- Constant Field Values
-
MANDATORY
public static final java.lang.String MANDATORY- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE- See Also:
- Constant Field Values
-
VALIDATION
public static final java.lang.String VALIDATION- See Also:
- Constant Field Values
-
-
Constructor Details
-
MetadataField
-
MetadataField
public MetadataField(java.lang.String type)
-
-
Method Details
-
getType
The type of the field.- Returns:
- String with the name of the type.
-
getExternalId
public java.lang.String getExternalId()Get the id of the field.- Returns:
- String, field id.
-
setExternalId
public void setExternalId(java.lang.String externalId)Set the id of the string (auto-generated if this is left blank).- Parameters:
externalId- The id to set.
-
getLabel
public java.lang.String getLabel()Get the label of the field- Returns:
- String, the label of the field.
-
setLabel
public void setLabel(java.lang.String label)Sets the label of the field- Parameters:
label- The label to set.
-
isMandatory
public boolean isMandatory()Cehcks whether the field is mandatory.- Returns:
- Boolean indicating whether the field is mandatory.
-
setMandatory
public void setMandatory(java.lang.Boolean mandatory)Sets a boolean indicating whether this fields needs to be mandatory.- Parameters:
mandatory- The boolean to set.
-
getDefaultValue
Gets the default value of this field.- Returns:
- The default value
- Throws:
java.text.ParseException- If the stored value can't be parsed to the correct type.
-
setDefaultValue
Set the default value of the field- Parameters:
defaultValue- The value to set.
-
getValidation
Get the validation rules of this field.- Returns:
- The validation rules.
-
setValidation
Set the validation rules of this field.- Parameters:
validation- The rules to set.
-
getDataSource
Get the data source definition of this field.- Returns:
- The data source.
-
setDataSource
Set the datasource for the field.- Parameters:
dataSource- The datasource to set.
-