|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.mapping.ResourcePropertyLookup
public final class ResourcePropertyLookup
A simple lookup class, for a given path, will provide simple access to it's path and value converter. Also supports path escaping ('a.b' or will result in a.b and not alias a and resource property b).
| Constructor Summary | |
|---|---|
ResourcePropertyLookup(CompassMapping compassMapping,
String name)
|
|
| Method Summary | |
|---|---|
String |
attemptNormalizeString(String value)
Tries to normalize the string using normalizeString(String), and if it fails, will
return the original value. |
Object |
fromString(String value)
Returns the Object converted from the String value. |
AliasMapping |
getAliasMapping()
Returns the alias mapping if using dot path notation. |
String |
getAnalyzer()
Returns the analyzer associated with the resource property. |
String |
getDotPathAlias()
Returns the alias used if using dot path notation. |
String |
getLookupName()
Returns the lookup name used in order to find the meta-data/property name. |
String |
getPath()
Returns the path matching the provided name. |
ResourcePropertyMapping |
getResourcePropertyMapping()
Returns the property mapping for the provided name. |
ResourcePropertyMapping[] |
getResourcePropertyMappings()
Returns a list of property mappings for the provided name. |
String |
getValue(Object value)
Returns the String representation of the provided value Object. |
boolean |
hasSpecificConverter()
Returns true if there is a specific converter that can be used to convert the
value. |
String |
normalizeString(String value)
Normalizes a given String value to a (hopefully) String value that mathces the one stored in the index. |
void |
setConvertOnlyWithDotPath(boolean convertOnlyWithDotPath)
Perform specialized convert only when dot path is used. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResourcePropertyLookup(CompassMapping compassMapping,
String name)
| Method Detail |
|---|
public void setConvertOnlyWithDotPath(boolean convertOnlyWithDotPath)
true.
Sometimes, several meta-data names are used with different converteres. For example map to title both a pure String value and also a numeric value. If using dot path notation, Compass will narrow down to the specfic converter (for example a.title.title). When not using dot path notation, Compass now has two options for conversion. If this flag is set to true (and not using dot path notation), Compass will use a converter based on the object type. If this flag is set to false, the first mapping is used to convert.
public String getAnalyzer()
null if none
is configured on the resource property or resource level.
public String getLookupName()
public String getDotPathAlias()
null if dot path notation
was not used.
public AliasMapping getAliasMapping()
null if dot path notation
was not used.
public String getPath()
public ResourcePropertyMapping getResourcePropertyMapping()
public ResourcePropertyMapping[] getResourcePropertyMappings()
public boolean hasSpecificConverter()
true if there is a specific converter that can be used to convert the
value.
Note, when setConvertOnlyWithDotPath(boolean) is set the true, and
the name passed to the lookup does not contain "dot notation", false will be returned.
public String getValue(Object value)
hasSpecificConverter()
return true, will use the first mapping definition for the given name in order to
convert it from Object to String. If it returns false, will use a Converter assigned to the given
parameter class. If a String is passed, will normalize it using normalizeString(String).
ResourcePropertyConverterpublic Object fromString(String value)
hasSpecificConverter() returns
true, will use the first mapping definition for the given name in order to conver it
from String to Object. If it returns false, will use a Converter assigned to the
given parameter class.
ResourcePropertyConverterpublic String attemptNormalizeString(String value)
normalizeString(String), and if it fails, will
return the original value.
public String normalizeString(String value)
throws ConversionException
If hasSpecificConverter() return false (note setConvertOnlyWithDotPath(boolean))
will simply return the given value.
If the ResourcePropertyConverter states that it should not be used
for normalization (ResourcePropertyConverter.canNormalize() returns
false), the provided value will be returned.
If none of the above happens, will convert it
ResourcePropertyConverter.fromString(String, org.compass.core.mapping.ResourcePropertyMapping)
and then ResourcePropertyConverter.toString(Object, org.compass.core.mapping.ResourcePropertyMapping).
ConversionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||