Interface TypeRegistry

  • public interface TypeRegistry
    The type registry serves two purposes: 1. It contains factory methods to create the different property types. 2.It optionally registers XMP types with names and makes them re-usable this way. The "named" types are also needed to reference predefined types in our fragment libraries. The registering part is not necessarily needed to create a schema.
    • Method Detail

      • getType

        PropertyType getType​(String typeName)
        Returns a registered type. This type must most be modified anymore, once it has been registered.
        typeName - name of the Type
        Returns the type if available in the registry otherwise null
      • getType

        PropertyType getType​(SimpleType.BasicType type)
        type - Enum value of the basic type
        Returns the default implementation of the the basic type
      • getTypes

        List<PropertyType> getTypes()
        Returns a collection of all registered Types
      • registerType

        void registerType​(String name,
                          PropertyType propertyType)
                   throws XMPSchemaException
        Registers a property type by name. Existing types must not be overwritten; array types cannot be registered
        name - the name of the property
        propertyType - the PropertyType to register
        XMPSchemaException - Thrown if the name is not valid or it is tried to register duplicate names.
      • createDerivedType

        SimpleType createDerivedType​(SimpleType.BasicType basicType)
        Creates a derived simple type from a basic type.
        basicType - one of the five basic types: Text, Boolean, Integer, Real or Date
        Returns the the derived type.
      • createDerivedType

        SimpleType createDerivedType​(SimpleType inheritedType)
        Creates a derived simple type. These are all types that add rules or other semantics to the basic types.
        inheritedType - any simple type
        Returns a new simple type.
      • createStruct

        StructType createStruct​(String namespaceURI)
        Creates a struct type.
        namespaceURI - a namespace
        Returns a new struct type
      • createArray

        ArrayType createArray​(ArrayType.ArrayForm form,
                              PropertyType itemType)
        Creates an array type. Array types cannot have a name, because they are rather defined by their item type.
        form - the form of the array
        itemType - the type of the array items
        Returns a new array type
      • registerUnspecifiedType

        PropertyType registerUnspecifiedType​(String typeName)
        Registers an unspecified type, that is just a place holder for a type that is defined later. This should be used only by schema parsers that want to do late binding on some types.
        typeName - the name of the type
        Returns an "unspecified" type.
      • getUnspecifiedTypes

        Collection<UnspecifiedType> getUnspecifiedTypes()
        Returns the list of unspecified types. Should be empty when the parsing is done.
      • replaceUnspecifiedType

        void replaceUnspecifiedType​(PropertyType unspecified,
                                    PropertyType finalType)
        Replaces the type of all properties that reference the unspecified type. Afterwards the unspecified type is deleted.
        unspecified - an unspecified property type
        finalType - the final property type.