|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.converter.basic.AbstractBasicConverter
org.compass.core.converter.dynamic.AbstractDynamicConverter
public abstract class AbstractDynamicConverter
A simple base class for DynamicConverter. Requires implementation of
evaluate(Object,org.compass.core.mapping.ResourcePropertyMapping).
Also holds a FormatConverter for expression that return formatable
objects (like Date).
| Field Summary |
|---|
| Fields inherited from interface org.compass.core.converter.dynamic.DynamicConverter |
|---|
DATA_CONTEXT_KEY |
| Constructor Summary | |
|---|---|
AbstractDynamicConverter()
|
|
| Method Summary | |
|---|---|
protected void |
addProperty(Object value,
ResourcePropertyMapping resourcePropertyMapping,
Object root,
MarshallingContext context,
Resource resource)
|
DynamicConverter |
copy()
Copies over the dynamic converter. |
protected Object |
doFromString(String str,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
Does nothing since there is no meaning for un-marshalling for dynamic converters |
protected abstract Object |
evaluate(Object o,
ResourcePropertyMapping resourcePropertyMapping)
Evaluates the given data object using the configured expression. |
Class |
getType()
The return type of the evaluated expression. |
boolean |
marshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
Marshall the given Object to the given Resource. |
void |
setFormatConverter(FormatConverter formatConverter)
If the dynamic expression evaluates to a formatable object (like Date), the format converter that will be used to format it. |
void |
setType(Class type)
The return type of the evaluated expression. |
Property.Index |
suggestIndex()
By default for all converters simply return null. |
Boolean |
suggestOmitNorms()
By default for all converters simply return null. |
Boolean |
suggestOmitTf()
By default for all converters simply return null. |
Property.Store |
suggestStore()
The converter can suggest the store type for this type in case no explicit one is configured. |
Property.TermVector |
suggestTermVector()
The converter can suggest if term vectors should be saved for this type in case no explicit one is configured. |
Object |
unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
Does nothing since there is no meaning for un-marshalling for dynamic converters |
| Methods inherited from class org.compass.core.converter.basic.AbstractBasicConverter |
|---|
canNormalize, createProperty, doSetBoost, doToString, fromString, fromString, getNullValue, handleNulls, isNullValue, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.compass.core.converter.dynamic.DynamicConverter |
|---|
setExpression |
| Constructor Detail |
|---|
public AbstractDynamicConverter()
| Method Detail |
|---|
public DynamicConverter copy()
DynamicConverter
copy in interface DynamicConverterpublic void setFormatConverter(FormatConverter formatConverter)
DynamicConverter
setFormatConverter in interface DynamicConverter
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 Convertermarshall in class AbstractBasicConverterresource - 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 void addProperty(Object value,
ResourcePropertyMapping resourcePropertyMapping,
Object root,
MarshallingContext context,
Resource resource)
protected abstract Object evaluate(Object o,
ResourcePropertyMapping resourcePropertyMapping)
throws ConversionException
o - The data objectresourcePropertyMapping - The resource mapping
ConversionException
public Object unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
throws ConversionException
unmarshall in interface Converterunmarshall in class AbstractBasicConverterresource - 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 doFromString(String str,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
throws ConversionException
doFromString in class AbstractBasicConverterConversionExceptionpublic Class getType()
DynamicConverter
getType in interface DynamicConverterpublic void setType(Class type)
DynamicConverter
setType in interface DynamicConverterpublic Property.Index suggestIndex()
AbstractBasicConverternull.
suggestIndex in interface ResourcePropertyConvertersuggestIndex in class AbstractBasicConverterpublic Property.TermVector suggestTermVector()
ResourcePropertyConverternull and will let global Compass defaults to be used.
suggestTermVector in interface ResourcePropertyConvertersuggestTermVector in class AbstractBasicConverterpublic Property.Store suggestStore()
ResourcePropertyConverternull and will let global Compass defaults to be used.
suggestStore in interface ResourcePropertyConvertersuggestStore in class AbstractBasicConverterpublic Boolean suggestOmitNorms()
AbstractBasicConverternull.
suggestOmitNorms in interface ResourcePropertyConvertersuggestOmitNorms in class AbstractBasicConverterpublic Boolean suggestOmitTf()
AbstractBasicConverternull.
suggestOmitTf in interface ResourcePropertyConvertersuggestOmitTf in class AbstractBasicConverter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||