Class XMP.Type

    • Field Detail

      • UNDEF

        public static final XMP.Type UNDEF
        The fallback type used when the element type is unknown
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getFields

        public List<XMP.Property> getFields()
        For a complex Type, return a read-only Collection of the Properties that make up the fields in this Type. Each Property will return this object from its XMP.Property.getOwnerType() method. Simple types (e.g. "Text") will return null
      • getField

        public XMP.Property getField​(String uri,
                                     String localName)
        If a complex Type, return the Property that has the matching namespace and name if one is present, otherwise return null. Because most fields in a complex Type share the same URI, setting that parameter to null means "match the first field with this localName".
        Parameters:
        uri - the namespace of the field being queried, or null to match any URI
        localName - the local name of the field being queried
        Returns:
        the matching Property if present, or null otherwise.
      • newField

        public XMP.Property newField​(String name,
                                     XMP.Type type,
                                     String description)
        Add a field to this type. If the field already exists it will be replaced.
        Parameters:
        name - the name of the property, which will be unique across this type
        type - the type of the field
        description - the description of the field, which is used when serializing the Field to a PDF/A extension, and is required.
      • isSimple

        public boolean isSimple()
        Return true if this type has no fields
      • getComponentType

        public XMP.Type getComponentType()
        For Types that are Lists of other types, return the Type of the collection. For example, the Type corresponding to "Seq Text" will return the "Text" Type. For non-List types, return null.
      • isUndefined

        public boolean isUndefined()
        Return true if this type is undefined
      • getName

        public String getName()
        Return the name of the type
      • getURI

        public String getURI()
        Return the namespace of the type, which is the same as the getURI() value of hte Schema that created this type
      • getDescription

        public String getDescription()
        Return the description of the type
      • create

        public XMP.Value create​(XMP xmp,
                                Object source)
        Create a new Value object of this type from the specified source.
        Parameters:
        xmp - the XMP this value is being created for
        source - the source, which should be parseable by this Type
        Throws:
        IllegalArgumentException - if the specified value cannot be parsed by this Type
      • bagOf

        public static XMP.Type bagOf​(XMP.Type type)
        Return a new Type that is a "Bag" of the supplied Type. This method is useful when creating new Schema of Types we have not yet added to the XMP. In other circumstances it's better to call XMP.getType(java.lang.String)
        Parameters:
        type - the Type
        Returns:
        a Bag of 'Type'
      • seqOf

        public static XMP.Type seqOf​(XMP.Type type)
        Return a new Type that is a "Seq" of the supplied Type. This method is useful when creating new Schema of Types we have not yet added to the XMP. In other circumstances it's better to call XMP.getType(java.lang.String)
        Parameters:
        type - the Type
        Returns:
        a Bag of 'Type'
      • altOf

        public static XMP.Type altOf​(XMP.Type type)
        Return a new Type that is an "Alt" of the supplied Type. This method is useful when creating new Schema of Types we have not yet added to the XMP. In other circumstances it's better to call XMP.getType(java.lang.String)
        Parameters:
        type - the Type
        Returns:
        a Bag of 'Type'
      • choiceOf

        public static XMP.Type choiceOf​(Integer... values)
        Return a new Type that is a "Closed Choice" of the specified integer values. This method is useful when creating a new Schema. When setting a value for this type via the API, the value must be in the specified list. When loading a property from an existing PDF that isn't in this list, the OutputProfile.Feature.XMPMetaDataTypeUnknownChoice feature is set (although this will not invalidate the XMP in any of the PDF/A profiles)
        Parameters:
        values - the list of values
      • choiceOf

        public static XMP.Type choiceOf​(String... values)
        Return a new Type that is a "Closed Choice" of the specified Text values. This method is useful when creating a new Schema. When setting a value for this type via the API, the value must be in the specified list. When loading a property from an existing PDF that isn't in this list, the OutputProfile.Feature.XMPMetaDataTypeUnknownChoice feature is set (although this will not invalidate the XMP in any of the PDF/A profiles)
        Parameters:
        values - the list of values