Interface FieldAdapter<T>
-
- All Known Subinterfaces:
ContentLabelsCategoryFieldAdapter
,ContentUsageAdapter
- All Known Implementing Classes:
ContentLabelsCategoryFieldAdapterImpl
,ContentLabelsFieldAdapter
,ContentReferenceFieldAdapter
,ContentUsageAdapterImpl
,CurrentFieldAdapter
,FieldAdapter.Identity
,HtmlToTextFieldAdapter
,UserIdToNameFieldAdapter
public interface FieldAdapter<T>
Class that takes specific values and transforms them into (possibly language specific) other values.- See Also:
Field
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
FieldAdapter.Identity
Identity implementation of FieldAdapter.
-
Field Summary
Fields Modifier and Type Field Description static FieldAdapter<Object>
IDENTITY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
adapt(T value, Locale forLocale)
Adapts a T to return the value in the specified language.boolean
isLanguageSpecific()
Returns whether the adapted value can depend on the language.
-
-
-
Field Detail
-
IDENTITY
static final FieldAdapter<Object> IDENTITY
-
-
Method Detail
-
isLanguageSpecific
boolean isLanguageSpecific()
Returns whether the adapted value can depend on the language.- Returns:
- true or false
-
adapt
Object adapt(T value, Locale forLocale)
Adapts a T to return the value in the specified language. The specified language may be null, in which case no specific language may be used. An implementation may return null, which is equivalent to "do not index this field for this language". The returned value is the one that is stored and is thus what is returned and displayed in Advanced Search. If this adapter is language specific, its adapt methods will be called for each language and for a null language to index the value in a language agnostic way (if possible). If it is not language specific, only the latter is the case. This method is only invoked if this adapter's field is stored. The returned value should match one of the registeredSOLR types
.- Parameters:
value
- the value to adaptforLocale
- the target locale to represent the value in- Returns:
- the adapted value, or null if no value should be stored
- See Also:
Field.stored()
-
-