Errai 3.0.1-SNAPSHOT

org.jboss.errai.marshalling.rebind
Class DefinitionsFactoryImpl

java.lang.Object
  extended by org.jboss.errai.marshalling.rebind.DefinitionsFactoryImpl
All Implemented Interfaces:
DefinitionsFactory

public class DefinitionsFactoryImpl
extends Object
implements DefinitionsFactory

The default implementation of DefinitionsFactory. This implementation covers the detection and mapping of classes annotated with the Portable annotation, and custom mappings annotated with CustomMapping.

Author:
Mike Brock

Method Summary
 void addDefinition(MappingDefinition definition)
          Registers a mapping definition with the factory
 Set<MetaClass> getArraySignatures()
           
 MappingDefinition getDefinition(Class<?> clazz)
          Returns a definition for the sepcified Class reference.
 MappingDefinition getDefinition(MetaClass clazz)
          Returns a definition for the specified MetaClass reference.
 MappingDefinition getDefinition(String clazz)
          Returns a definition for the fully-qualified class name provided.
 Set<MetaClass> getExposedClasses()
          Returns a set of all exposed classes.
 Map<String,String> getMappingAliases()
          Returns a map of aliases mappers.
 Collection<MappingDefinition> getMappingDefinitions()
          Returns a collection of all registered mapping definitions.
 boolean hasBuiltInDefinition(MetaClass type)
           
 boolean hasDefinition(Class<?> clazz)
          Return true if a definition is registered for the specified Class reference.
 boolean hasDefinition(MetaClass clazz)
          Return true if a definition is registered for the specified MetaClass
 boolean hasDefinition(String clazz)
          Returns true if a definition is registered matching fully-qualified class name provided.
 boolean isExposedClass(MetaClass clazz)
          Returns true if the class is exposed for marshalling.
 void mergeDefinition(MappingDefinition def)
          Merge the specified definition with any existing definitions in the specified definitions class hierarchy.
 void resetDefinitionsAndReload()
           
 boolean shouldUseObjectMarshaller(MetaClass type)
          Returns true if the marshalling system should treat the given type as polymorphic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasDefinition

public boolean hasDefinition(String clazz)
Description copied from interface: DefinitionsFactory
Returns true if a definition is registered matching fully-qualified class name provided. If this DefinitionsFactory has a definition for , that means it can marshall and demarshall instances of clazz.

Specified by:
hasDefinition in interface DefinitionsFactory
Parameters:
clazz - fully qualified class name.
Returns:
boolean true if defined.

getDefinition

public MappingDefinition getDefinition(String clazz)
Description copied from interface: DefinitionsFactory
Returns a definition for the fully-qualified class name provided.

Specified by:
getDefinition in interface DefinitionsFactory
Parameters:
clazz - fully qualified class name.
Returns:
an instance of the mapping definition, if defined. returns null if not defined.

hasDefinition

public boolean hasDefinition(MetaClass clazz)
Description copied from interface: DefinitionsFactory
Return true if a definition is registered for the specified MetaClass

Specified by:
hasDefinition in interface DefinitionsFactory
Parameters:
clazz - class reference
Returns:
boolean true if defined.

hasDefinition

public boolean hasDefinition(Class<?> clazz)
Description copied from interface: DefinitionsFactory
Return true if a definition is registered for the specified Class reference.

Specified by:
hasDefinition in interface DefinitionsFactory
Parameters:
clazz - class reference.
Returns:
boolean true if defined.

addDefinition

public void addDefinition(MappingDefinition definition)
Description copied from interface: DefinitionsFactory
Registers a mapping definition with the factory

Specified by:
addDefinition in interface DefinitionsFactory
Parameters:
definition - a mapping definition

getDefinition

public MappingDefinition getDefinition(MetaClass clazz)
Description copied from interface: DefinitionsFactory
Returns a definition for the specified MetaClass reference.

Specified by:
getDefinition in interface DefinitionsFactory
Parameters:
clazz - class reference
Returns:
an instance of the mapping definition, if defined. returns null if not defined.

getDefinition

public MappingDefinition getDefinition(Class<?> clazz)
Description copied from interface: DefinitionsFactory
Returns a definition for the sepcified Class reference.

Specified by:
getDefinition in interface DefinitionsFactory
Parameters:
clazz - class reference
Returns:
an instance of the mapping definition, if defined. returns null if not defined.

shouldUseObjectMarshaller

public boolean shouldUseObjectMarshaller(MetaClass type)
Description copied from interface: DefinitionsFactory
Returns true if the marshalling system should treat the given type as polymorphic.

Specified by:
shouldUseObjectMarshaller in interface DefinitionsFactory
Parameters:
type - The type to test for the existence of portable implementation/subtypes.

mergeDefinition

public void mergeDefinition(MappingDefinition def)
Description copied from interface: DefinitionsFactory
Merge the specified definition with any existing definitions in the specified definitions class hierarchy. In general, if a mapping exists for the parent class of the specified definition, then its mappings will be merged in -- if they're not covered by the specified mapping. Overloaded constructor mappings will be detected, if the specified mapping does not define a constructor mapping.

Specified by:
mergeDefinition in interface DefinitionsFactory
Parameters:
def - a mapping definition to merge.

isExposedClass

public boolean isExposedClass(MetaClass clazz)
Description copied from interface: DefinitionsFactory
Returns true if the class is exposed for marshalling. This is not the same as whether or not it has a defined definition.Just that the class is expected to be marshallable.

Specified by:
isExposedClass in interface DefinitionsFactory
Parameters:
clazz - fully qualified class name.
Returns:
boolean true if exposed.

getExposedClasses

public Set<MetaClass> getExposedClasses()
Description copied from interface: DefinitionsFactory
Returns a set of all exposed classes.

Specified by:
getExposedClasses in interface DefinitionsFactory
Returns:
a set of exposed classes.

getArraySignatures

public Set<MetaClass> getArraySignatures()
Specified by:
getArraySignatures in interface DefinitionsFactory

getMappingAliases

public Map<String,String> getMappingAliases()
Description copied from interface: DefinitionsFactory
Returns a map of aliases mappers. The keys represent the aliases and values represent the concrete mapping classes to use as a basis.

Specified by:
getMappingAliases in interface DefinitionsFactory
Returns:
a map of aliases.

getMappingDefinitions

public Collection<MappingDefinition> getMappingDefinitions()
Description copied from interface: DefinitionsFactory
Returns a collection of all registered mapping definitions.

Specified by:
getMappingDefinitions in interface DefinitionsFactory

resetDefinitionsAndReload

public void resetDefinitionsAndReload()
Specified by:
resetDefinitionsAndReload in interface DefinitionsFactory

hasBuiltInDefinition

public boolean hasBuiltInDefinition(MetaClass type)
Specified by:
hasBuiltInDefinition in interface DefinitionsFactory

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.