|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.converter.mapping.osem.ClassMappingConverter
public class ClassMappingConverter
| Nested Class Summary | |
|---|---|
protected static class |
ClassMappingConverter.IdentityAliasedObjectKey
An object key based on the alias and the object identity hash code |
protected static class |
ClassMappingConverter.IdsAliasesObjectKey
An object key based on the alias and its ids values |
| Field Summary | |
|---|---|
static String |
DISABLE_INTERNAL_MAPPINGS
Disable internal mappings is a marker within the context if internal mappings should not be marshalled. |
static String |
DISABLE_UID_MARSHALLING
|
static String |
ROOT_CLASS_MAPPING_KEY
Under this key within the context the root class mapping can be found. |
| Constructor Summary | |
|---|---|
ClassMappingConverter()
|
|
| Method Summary | |
|---|---|
void |
configure(CompassSettings settings)
Configure using the given settings. |
protected Object |
constructObjectForUnmarshalling(ClassMapping classMapping,
Resource resource,
MarshallingContext context)
Constructs the object used for unmarshalling (no properties are set/unmarshalled) on it. |
protected boolean |
doMarshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
|
protected void |
doSetBoost(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
A simple extension point that allows to set the boost value for the created Resource. |
protected String |
getPolyClassName(Object root)
An extension point allowing to get the poly class name if need to be stored. |
boolean |
marshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
Marshall the given Object to the given Resource. |
boolean |
marshallIds(Resource idResource,
Object id,
ResourceMapping resourceMapping,
MarshallingContext context)
Marshalls teh given Object id into the given resource. |
protected void |
storeEnumName(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
Stores the Enum.name() in order to construct it afterwards. |
protected void |
storePolyClass(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
Stores the poly class name callback. |
Object |
unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
Unmarshall the given Resource to the appropiate Object. |
Object[] |
unmarshallIds(Object id,
ResourceMapping resourceMapping,
MarshallingContext context)
Unamrshalls the given id into its id properties values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ROOT_CLASS_MAPPING_KEY
public static final String DISABLE_INTERNAL_MAPPINGS
Internal mappings are disabled for inner components (not root classes) when support
unmarshall is set to false.
public static final String DISABLE_UID_MARSHALLING
| Constructor Detail |
|---|
public ClassMappingConverter()
| Method Detail |
|---|
public void configure(CompassSettings settings)
throws CompassException
CompassConfigurable
configure in interface CompassConfigurablesettings - The settings for the configured object
CompassException
public boolean marshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
throws ConversionException
ConverterObject to the given Resource. Will use
the mapping definition as to how to marshall the object.
Returns true if data was saved in the index, and it can
be read as well (i.e. stored).
marshall in interface Converterresource - The resource to marhsall the object toroot - The Object to marshall to the resourcemapping - The mapping definition of how to marshall the Object to the resorucecontext - The context for the current marhslling process
true if data was saved in the the index that can be read.
ConversionException
protected boolean doMarshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
throws ConversionException
ConversionException
public Object unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
throws ConversionException
ConverterResource to the appropiate Object.
unmarshall in interface Converterresource - The resource to unmarshall into an Objectmapping - The mapping definition of how to unmarshall the Resource into an Objectcontext - The context for the current marshalling process
ConversionException
protected Object constructObjectForUnmarshalling(ClassMapping classMapping,
Resource resource,
MarshallingContext context)
throws ConversionException
null return value denotes no un-marshalling should be performed.
ConversionException
public boolean marshallIds(Resource idResource,
Object id,
ResourceMapping resourceMapping,
MarshallingContext context)
throws ConversionException
ResourceMappingConverterObject id into the given resource. Returns true
if anything was was stored in the resource.
marshallIds in interface ResourceMappingConverterConversionException
public Object[] unmarshallIds(Object id,
ResourceMapping resourceMapping,
MarshallingContext context)
throws ConversionException
ResourceMappingConverter
unmarshallIds in interface ResourceMappingConverterConversionException
protected void doSetBoost(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
throws ConversionException
Resource.
The default implemenation uses the statically defined boost value in the mapping definition
(AbstractResourceMapping.getBoost()) to set the boost level
using Resource.setBoost(float)
Note, that this method will only be called on a root level (root=true) mapping.
resource - The resource to set the boost onroot - The Object that is marshalled into the respective ResourceclassMapping - The Class Mapping deifnitioncontext - The marshalling context
ConversionException
protected void storePolyClass(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
getPolyClassName(Object) in order to get
the poly class and store it.
protected void storeEnumName(Resource resource,
Object root,
ClassMapping classMapping,
MarshallingContext context)
Enum.name() in order to construct it afterwards.
protected String getPolyClassName(Object root)
ProxyExtractorHelper.getTargetClass(Object).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||