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 Details

  • Constructor Details

  • Method Details

    • getType

      public MetadataFieldType 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

      public T getDefaultValue() throws java.text.ParseException
      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

      public void setDefaultValue​(T defaultValue)
      Set the default value of the field
      Parameters:
      defaultValue - The value to set.
    • getValidation

      public MetadataValidation getValidation()
      Get the validation rules of this field.
      Returns:
      The validation rules.
    • setValidation

      public void setValidation​(MetadataValidation validation)
      Set the validation rules of this field.
      Parameters:
      validation - The rules to set.
    • getDataSource

      public MetadataDataSource getDataSource()
      Get the data source definition of this field.
      Returns:
      The data source.
    • setDataSource

      public void setDataSource​(MetadataDataSource dataSource)
      Set the datasource for the field.
      Parameters:
      dataSource - The datasource to set.