Package com.adobe.xmp.schema.model
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 Summary
Modifier and TypeMethodDescriptioncreateArray(ArrayType.ArrayForm form, PropertyType itemType) Creates an array type.createDerivedType(SimpleType inheritedType) Creates a derived simple type.createDerivedType(SimpleType.BasicType basicType) Creates a derived simple type from a basic type.createStruct(String namespaceURI) Creates a struct type.getType(SimpleType.BasicType type) Returns a registered type.getTypes()voidregisterType(String name, PropertyType propertyType) Registers a property type by name.registerUnspecifiedType(String typeName) Registers an unspecified type, that is just a place holder for a type that is defined later.voidreplaceUnspecifiedType(PropertyType unspecified, PropertyType finalType) Replaces the type of all properties that reference the unspecified type.
-
Method Details
-
getType
Returns a registered type. This type must most be modified anymore, once it has been registered.- Parameters:
typeName- name of the Type- Returns:
- Returns the type if available in the registry otherwise
null
-
getType
- Parameters:
type- Enum value of the basic type- Returns:
- Returns the default implementation of the the basic type
-
getTypes
List<PropertyType> getTypes()- Returns:
- Returns a collection of all registered Types
-
registerType
Registers a property type by name. Existing types must not be overwritten; array types cannot be registered- Parameters:
name- the name of the propertypropertyType- the PropertyType to register- Throws:
XMPSchemaException- Thrown if the name is not valid or it is tried to register duplicate names.
-
createDerivedType
Creates a derived simple type from a basic type.- Parameters:
basicType- one of the five basic types: Text, Boolean, Integer, Real or Date- Returns:
- Returns the the derived type.
-
createDerivedType
Creates a derived simple type. These are all types that add rules or other semantics to the basic types.- Parameters:
inheritedType- any simple type- Returns:
- Returns a new simple type.
-
createStruct
Creates a struct type.- Parameters:
namespaceURI- a namespace- Returns:
- Returns a new struct type
-
createArray
Creates an array type. Array types cannot have a name, because they are rather defined by their item type.- Parameters:
form- the form of the arrayitemType- the type of the array items- Returns:
- Returns a new array type
-
registerUnspecifiedType
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.- Parameters:
typeName- the name of the type- Returns:
- Returns an "unspecified" type.
-
getUnspecifiedTypes
Collection<UnspecifiedType> getUnspecifiedTypes()- Returns:
- Returns the list of unspecified types. Should be empty when the parsing is done.
-
replaceUnspecifiedType
Replaces the type of all properties that reference the unspecified type. Afterwards the unspecified type is deleted.- Parameters:
unspecified- an unspecified property typefinalType- the final property type.
-