Package com.rbmhtechnology.vind.model
Class FieldDescriptor<T>
- java.lang.Object
-
- com.rbmhtechnology.vind.model.FieldDescriptor<T>
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ComplexFieldDescriptor
,MultiValueFieldDescriptor
,SingleValueFieldDescriptor
public abstract class FieldDescriptor<T> extends Object implements Serializable
General type-independent field descriptor. It is implemented by type specific field descriptors.- Since:
- 15.06.16.
- Author:
- Thomas Kurz ([email protected])
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FieldDescriptor.UseCase
-
Field Summary
Fields Modifier and Type Field Description protected boolean
sort
protected Function<?,T>
sortFunction
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldDescriptor(String fieldName, Class<T> type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
checkFieldType(Class<?> type)
Checks if a class is a valid field content type.float
getBoost()
Gets the field configured boosting value.Language
getLanguage()
Gets the field language configured.Map<String,String>
getMetadata()
Gets the field configured metadata.String
getName()
Gets the field Name.Class<T>
getType()
Gets the field type of content.boolean
hasUseCase(FieldDescriptor.UseCase useCase)
Cheks if a the field descriptor has the given usecase defined.boolean
isContextualized()
Filter
isEmpty()
Instantiates a newFilter
to checking if a field value is empty.boolean
isFacet()
Checks if a field is use for faceting or not.boolean
isFullText()
Checks if a field is fullText searchable or not.boolean
isIndexed()
Checks if a field is indexed or not.boolean
isMultiValue()
Checks if a field is multivalued or not.Filter
isNotEmpty()
Instantiates a newFilter
to checking if a field value is not empty.boolean
isSort()
boolean
isStored()
Checks if a field is stored or not.boolean
isSuggest()
Checks if a field is use for suggesting or not.boolean
isUpdate()
protected void
setBoost(float boost)
void
setContextualized(boolean contextualized)
protected void
setFacet(boolean facet)
protected void
setFullText(boolean fullText)
protected void
setIndexed(boolean indexed)
protected void
setLanguage(Language language)
protected void
setMetadata(Map<String,String> metadata)
protected void
setMultiValue(boolean multiValue)
protected void
setName(String name)
FieldDescriptor<T>
setSort(Function<Collection<T>,T> lambda)
protected void
setStored(boolean stored)
protected void
setSuggest(boolean suggest)
protected void
setUpdate(boolean update)
String
toString()
-
-
-
Method Detail
-
checkFieldType
public static boolean checkFieldType(Class<?> type)
Checks if a class is a valid field content type.- Parameters:
type
- Class to be checked.- Returns:
- True if it is a valid content, false otherwise.
-
getName
public String getName()
Gets the field Name.- Returns:
- Field name.
-
setName
protected void setName(String name)
-
setStored
protected void setStored(boolean stored)
-
isStored
public boolean isStored()
Checks if a field is stored or not.- Returns:
- True if it is configured to be stored.
-
setIndexed
protected void setIndexed(boolean indexed)
-
isIndexed
public boolean isIndexed()
Checks if a field is indexed or not.- Returns:
- True if it is configured to be indexed.
-
setFullText
protected void setFullText(boolean fullText)
-
isFullText
public boolean isFullText()
Checks if a field is fullText searchable or not.- Returns:
- True if it is configured to be fullText searchable.
-
setLanguage
protected void setLanguage(Language language)
-
getLanguage
public Language getLanguage()
Gets the field language configured.- Returns:
- Field Language
-
setBoost
protected void setBoost(float boost)
-
getBoost
public float getBoost()
Gets the field configured boosting value.- Returns:
- Field boost.
-
setFacet
protected void setFacet(boolean facet)
-
isFacet
public boolean isFacet()
Checks if a field is use for faceting or not.- Returns:
- True if it is configured to be use for facets.
-
setSuggest
protected void setSuggest(boolean suggest)
-
isSuggest
public boolean isSuggest()
Checks if a field is use for suggesting or not.- Returns:
- True if it is configured to be use for suggestion.
-
isMultiValue
public boolean isMultiValue()
Checks if a field is multivalued or not.- Returns:
- True if it is configured to be multivalued.
-
setMultiValue
protected void setMultiValue(boolean multiValue)
-
getMetadata
public Map<String,String> getMetadata()
Gets the field configured metadata.- Returns:
- Field metadata
-
isSort
public boolean isSort()
-
setSort
public FieldDescriptor<T> setSort(Function<Collection<T>,T> lambda)
-
isUpdate
public boolean isUpdate()
-
setUpdate
protected void setUpdate(boolean update)
-
isContextualized
public boolean isContextualized()
-
setContextualized
public void setContextualized(boolean contextualized)
-
isNotEmpty
public Filter isNotEmpty()
Instantiates a newFilter
to checking if a field value is not empty.- Returns:
- A configured filter for the field.
-
isEmpty
public Filter isEmpty()
Instantiates a newFilter
to checking if a field value is empty.- Returns:
- A configured filter for the field.
-
hasUseCase
public boolean hasUseCase(FieldDescriptor.UseCase useCase)
Cheks if a the field descriptor has the given usecase defined.- Parameters:
useCase
-FieldDescriptor.UseCase
to check if the field is configured to support.- Returns:
- returns true if the field is configured to work with the provided usecase, false otherwise.
-
-