org.codehaus.xfire.type
Class DefaultTypeMappingRegistry

java.lang.Object
  extended by org.codehaus.xfire.AbstractXFireComponent
      extended by org.codehaus.xfire.type.DefaultTypeMappingRegistry
All Implemented Interfaces:
TypeMappingRegistry
Direct Known Subclasses:
TypeMappingRegistry, TypeMappingRegistry

public class DefaultTypeMappingRegistry
extends AbstractXFireComponent
implements TypeMappingRegistry

The default implementation of TypeMappingRegistry.

Since:
Feb 22, 2004
Author:
Dan Diephouse

Field Summary
 
Fields inherited from interface org.codehaus.xfire.type.TypeMappingRegistry
ROLE
 
Constructor Summary
DefaultTypeMappingRegistry()
           
DefaultTypeMappingRegistry(boolean createDefault)
           
 
Method Summary
 void clear()
          Removes all registered TypeMappings and encodingStyleURIs from this TypeMappingRegistry.
 TypeMapping createDefaultMappings()
           
 TypeMapping createTypeMapping(boolean autoTypes)
          Creates a new empty TypeMapping object.
 TypeMapping createTypeMapping(java.lang.String parentNamespace, boolean autoTypes)
          Create a type mapping with the specified encodying style.
protected  TypeMapping createTypeMapping(TypeMapping parent, boolean autoTypes)
           
 TypeMapping getDefaultTypeMapping()
          Gets the registered default TypeMapping instance.
 java.lang.String[] getRegisteredEncodingStyleURIs()
          Returns a list of registered encodingStyle URIs in this TypeMappingRegistry instance.
 TypeMapping getTypeMapping(java.lang.String encodingStyleURI)
          Returns the registered TypeMapping for the specified encodingStyle URI.
 TypeMapping register(java.lang.String encodingStyleURI, TypeMapping mapping)
           
 void registerDefault(TypeMapping mapping)
           
 boolean removeTypeMapping(TypeMapping mapping)
          Removes a TypeMapping from the TypeMappingRegistry.
 TypeMapping unregisterTypeMapping(java.lang.String encodingStyleURI)
          Unregisters a TypeMapping instance, if present, from the specified encodingStyleURI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTypeMappingRegistry

public DefaultTypeMappingRegistry()

DefaultTypeMappingRegistry

public DefaultTypeMappingRegistry(boolean createDefault)
Method Detail

register

public TypeMapping register(java.lang.String encodingStyleURI,
                            TypeMapping mapping)
Specified by:
register in interface TypeMappingRegistry

registerDefault

public void registerDefault(TypeMapping mapping)
Specified by:
registerDefault in interface TypeMappingRegistry

getDefaultTypeMapping

public TypeMapping getDefaultTypeMapping()
Description copied from interface: TypeMappingRegistry
Gets the registered default TypeMapping instance. This method returns null if there is no registered default TypeMapping in the registry.

Specified by:
getDefaultTypeMapping in interface TypeMappingRegistry
Returns:
The registered default TypeMapping instance or null.
See Also:
TypeMappingRegistry.getDefaultTypeMapping()

getRegisteredEncodingStyleURIs

public java.lang.String[] getRegisteredEncodingStyleURIs()
Description copied from interface: TypeMappingRegistry
Returns a list of registered encodingStyle URIs in this TypeMappingRegistry instance.

Specified by:
getRegisteredEncodingStyleURIs in interface TypeMappingRegistry
Returns:
Array of the registered encodingStyle URIs
See Also:
TypeMappingRegistry.getRegisteredEncodingStyleURIs()

getTypeMapping

public TypeMapping getTypeMapping(java.lang.String encodingStyleURI)
Description copied from interface: TypeMappingRegistry
Returns the registered TypeMapping for the specified encodingStyle URI. If there is no registered TypeMapping for the specified encodingStyleURI, this method returns null.

Specified by:
getTypeMapping in interface TypeMappingRegistry
Parameters:
encodingStyleURI - Encoding style specified as an URI
Returns:
TypeMapping for the specified encodingStyleURI or null
See Also:
TypeMappingRegistry.getTypeMapping(java.lang.String)

createTypeMapping

public TypeMapping createTypeMapping(boolean autoTypes)
Description copied from interface: TypeMappingRegistry
Creates a new empty TypeMapping object.

Specified by:
createTypeMapping in interface TypeMappingRegistry
Returns:
TypeMapping instance.
See Also:
TypeMappingRegistry.createTypeMapping(boolean)

createTypeMapping

public TypeMapping createTypeMapping(java.lang.String parentNamespace,
                                     boolean autoTypes)
Description copied from interface: TypeMappingRegistry
Create a type mapping with the specified encodying style.

Specified by:
createTypeMapping in interface TypeMappingRegistry
Parameters:
parentNamespace - Encoding style specified as an URI
autoTypes - Should this mapping auto-generate types where possible
Returns:
TypeMapping instance
See Also:
TypeMappingRegistry.createTypeMapping(String, boolean)

createTypeMapping

protected TypeMapping createTypeMapping(TypeMapping parent,
                                        boolean autoTypes)

unregisterTypeMapping

public TypeMapping unregisterTypeMapping(java.lang.String encodingStyleURI)
Description copied from interface: TypeMappingRegistry
Unregisters a TypeMapping instance, if present, from the specified encodingStyleURI.

Specified by:
unregisterTypeMapping in interface TypeMappingRegistry
Parameters:
encodingStyleURI - Encoding style specified as an URI
Returns:
TypeMapping instance that has been unregistered or null if there was no TypeMapping registered for the specified encodingStyleURI
See Also:
TypeMappingRegistry.unregisterTypeMapping(java.lang.String)

removeTypeMapping

public boolean removeTypeMapping(TypeMapping mapping)
Description copied from interface: TypeMappingRegistry
Removes a TypeMapping from the TypeMappingRegistry. A TypeMapping is associated with 1 or more encodingStyleURIs. This method unregisters the specified TypeMapping instance from all associated encodingStyleURIs and then removes this TypeMapping instance from the registry.

Specified by:
removeTypeMapping in interface TypeMappingRegistry
Parameters:
mapping - TypeMapping to remove
Returns:
true if specified TypeMapping is removed from the TypeMappingRegistry; false if the specified TypeMapping was not in the TypeMappingRegistry

clear

public void clear()
Description copied from interface: TypeMappingRegistry
Removes all registered TypeMappings and encodingStyleURIs from this TypeMappingRegistry.

Specified by:
clear in interface TypeMappingRegistry
See Also:
TypeMappingRegistry.clear()

createDefaultMappings

public TypeMapping createDefaultMappings()