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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ArrayType
createArray(ArrayType.ArrayForm form, PropertyType itemType)
Creates an array type.SimpleType
createDerivedType(SimpleType inheritedType)
Creates a derived simple type.SimpleType
createDerivedType(SimpleType.BasicType basicType)
Creates a derived simple type from a basic type.StructType
createStruct(java.lang.String namespaceURI)
Creates a struct type.PropertyType
getType(SimpleType.BasicType type)
PropertyType
getType(java.lang.String typeName)
Returns a registered type.java.util.List<PropertyType>
getTypes()
java.util.Collection<UnspecifiedType>
getUnspecifiedTypes()
void
registerType(java.lang.String name, PropertyType propertyType)
Registers a property type by name.PropertyType
registerUnspecifiedType(java.lang.String typeName)
Registers an unspecified type, that is just a place holder for a type that is defined later.void
replaceUnspecifiedType(PropertyType unspecified, PropertyType finalType)
Replaces the type of all properties that reference the unspecified type.
-
-
-
Method Detail
-
getType
PropertyType getType(java.lang.String typeName)
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
PropertyType getType(SimpleType.BasicType type)
- Parameters:
type
- Enum value of the basic type- Returns:
- Returns the default implementation of the the basic type
-
getTypes
java.util.List<PropertyType> getTypes()
- Returns:
- Returns a collection of all registered Types
-
registerType
void registerType(java.lang.String name, PropertyType propertyType) throws XMPSchemaException
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
SimpleType createDerivedType(SimpleType.BasicType basicType)
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
SimpleType createDerivedType(SimpleType inheritedType)
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
StructType createStruct(java.lang.String namespaceURI)
Creates a struct type.- Parameters:
namespaceURI
- a namespace- Returns:
- 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.- Parameters:
form
- the form of the arrayitemType
- the type of the array items- Returns:
- Returns a new array type
-
registerUnspecifiedType
PropertyType registerUnspecifiedType(java.lang.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.- Parameters:
typeName
- the name of the type- Returns:
- Returns an "unspecified" type.
-
getUnspecifiedTypes
java.util.Collection<UnspecifiedType> getUnspecifiedTypes()
- Returns:
- 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.- Parameters:
unspecified
- an unspecified property typefinalType
- the final property type.
-
-