Class XMP.Schema

  • Enclosing class:
    XMP

    public static class XMP.Schema
    extends java.lang.Object
    A Schema is a collection of properties and types, grouped together under a single XML namespace. A large number of predefined Schema are shipped with this class, and it's possible to create new Schema as well to defined custom properties or types.
    See Also:
    XMP.addSchema(org.faceless.pdf2.XMP.Schema)
    • Constructor Summary

      Constructors 
      Constructor Description
      Schema​(java.lang.String uri, java.lang.String prefix, java.lang.String description)
      Create a new custom Schema.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getDescription()
      Return the Description of the Schema
      java.lang.String getPrefix()
      Return the preferred prefix of the Schema
      java.util.Map<java.lang.String,​XMP.Property> getProperties()
      Return a read-only collection of the Properties defined in this Schema.
      java.util.Map<java.lang.String,​XMP.Type> getTypes()
      Return a read-only collection of the Types defined in this Schema.
      java.lang.String getURI()
      Return the URI of the Schema
      int hashCode()  
      boolean isValid()
      Return true if the URI ends with a '/' or '#', which is recommended for XMP and a requirement for PDF/A
      XMP.Property newProperty​(java.lang.String name, XMP.Type type, java.lang.String description, boolean external)
      Create a new property on this Schema.
      XMP.Property newQualifierProperty​(java.lang.String name, XMP.Type type, java.lang.String description, boolean external)
      Create a new qualifier property on this Schema.
      XMP.Type newType​(java.lang.String name, java.lang.String description)
      Create a new Type on this Schema.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Schema

        public Schema​(java.lang.String uri,
                      java.lang.String prefix,
                      java.lang.String description)
        Create a new custom Schema.
        Parameters:
        uri - the namespace URI. It is required (in XMP until 2008) and recommended (in modern XMP) that the namespace ends with a "#" or "/" character
        prefix - the preferred prefix to use when serializing properties in this namespace
        description - a description of this Schema, which will be used when creating a PDF/A extension schema.
    • Method Detail

      • getPrefix

        public java.lang.String getPrefix()
        Return the preferred prefix of the Schema
      • getURI

        public java.lang.String getURI()
        Return the URI of the Schema
      • getDescription

        public java.lang.String getDescription()
        Return the Description of the Schema
      • isValid

        public boolean isValid()
        Return true if the URI ends with a '/' or '#', which is recommended for XMP and a requirement for PDF/A
        Since:
        2.25
      • getProperties

        public java.util.Map<java.lang.String,​XMP.Property> getProperties()
        Return a read-only collection of the Properties defined in this Schema. The key is XMP.Property.getName()
      • getTypes

        public java.util.Map<java.lang.String,​XMP.Type> getTypes()
        Return a read-only collection of the Types defined in this Schema. The key is XMP.Type.getName()
      • newProperty

        public XMP.Property newProperty​(java.lang.String name,
                                        XMP.Type type,
                                        java.lang.String description,
                                        boolean external)
        Create a new property on this Schema. If an Property exists with this name, it will be replaced
        Parameters:
        name - the name of the Property, which must not be null
        type - the type of the Proeprty, which must not be null
        description - the description of the Property, which must not be null and will be used when creating a PDF/A extension schema
        external - whether the Property is internal or external. Required, but purpose unknown and it doesn't seem to make any difference.
        Returns:
        the Property
      • newQualifierProperty

        public XMP.Property newQualifierProperty​(java.lang.String name,
                                                 XMP.Type type,
                                                 java.lang.String description,
                                                 boolean external)
        Create a new qualifier property on this Schema. If an Property exists with this name, it will be replaced The returned property can only be used to qualify other properties
        Parameters:
        name - the name of the Property, which must not be null
        type - the type of the Proeprty, which must not be null
        description - the description of the Property, which must not be null and will be used when creating a PDF/A extension schema
        external - whether the Property is internal or external. Required, but purpose unknown and it doesn't seem to make any difference.
        Returns:
        the Property
        See Also:
        XMP.Value.putQualifier(org.faceless.pdf2.XMP.Property, org.faceless.pdf2.XMP.Value)
      • newType

        public XMP.Type newType​(java.lang.String name,
                                java.lang.String description)
        Create a new Type on this Schema. If a Type exists with this name, it will be replaced.
        Parameters:
        name - the name of the Type, which must not be null
        description - the decription of the Type, which must not be null
        Returns:
        the Type
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object