Type - class of mapped typeId - class of mapped type's IDpublic abstract class GenericTypeMapping<Type,Id> extends TypeMapping
TypeMapping. All subclasses should extend this
class instead of TypeMapping while it's generally better to use
TypeMapping where the exact type of mapping is not known or not
relevantFIELD_ID, FIELD_INDEX, FIELD_TYPE, FIELD_VERSION| Constructor and Description |
|---|
GenericTypeMapping(String typeAlias,
Class<Type> typeClass,
Class<Id> idClass) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
buildMapping(org.elasticsearch.index.mapper.object.RootObjectMapper.Builder mapperBuilder) |
protected Type |
cast(Object o) |
protected Id |
castId(Object o) |
protected boolean |
filter(Type o) |
org.elasticsearch.common.xcontent.XContentBuilder |
getContentBuilder(Object o)
public for testing.
|
Id |
getId(Object o) |
Class<Id> |
getIdClass() |
MappingSource |
getMappingSource() |
ObjectSource |
getObjectSource(Object o) |
protected Map<String,Object> |
getSource(org.elasticsearch.action.get.GetResponse response) |
protected Map<String,Object> |
getSource(org.elasticsearch.search.SearchHit hit) |
Class<Type> |
getTypeClass() |
Long |
getVersion(Object o)
gets version from object or null if not versioned
|
protected abstract Id |
id(Type o)
get Id from object
|
boolean |
isFiltered(Object entity)
Simple filtering of entities.
|
Type |
read(org.elasticsearch.action.get.GetResponse response) |
abstract Type |
read(Map<String,Object> source)
read object from source.
|
Type |
read(org.elasticsearch.search.SearchHit hit) |
abstract Id |
toId(String id) |
String |
toIdString(Object id) |
abstract String |
toString(Id id) |
protected abstract Long |
version(Type o)
get version from object
|
void |
write(org.elasticsearch.common.xcontent.XContentBuilder contentBuilder,
Object o) |
protected abstract void |
writeObject(org.elasticsearch.common.xcontent.XContentBuilder contentBuilder,
Type o) |
deleteRequest, deleteRequest, deleteRequest, deleteRequest, getIdString, getTypeAlias, indexRequest, indexRequest, isVersionedpublic final MappingSource getMappingSource()
getMappingSource in class TypeMappingMappingSource for this typepublic ObjectSource getObjectSource(Object o)
getObjectSource in class TypeMappingObjectSource for this objectpublic final org.elasticsearch.common.xcontent.XContentBuilder getContentBuilder(Object o) throws IOException
IOExceptionpublic final void write(org.elasticsearch.common.xcontent.XContentBuilder contentBuilder,
Object o)
throws IOException
IOExceptionpublic final Type read(org.elasticsearch.action.get.GetResponse response)
read in class TypeMappingGetResponse or null if not
applicable or doc doesn't existpublic final Type read(org.elasticsearch.search.SearchHit hit)
read in class TypeMappingSearchHit or null if not
applicableprotected Map<String,Object> getSource(org.elasticsearch.action.get.GetResponse response)
GetResponsegetSource(SearchHit)protected Map<String,Object> getSource(org.elasticsearch.search.SearchHit hit)
SearchHitgetSource(GetResponse)public Class<Type> getTypeClass()
getTypeClass in class TypeMappingpublic Class<Id> getIdClass()
getIdClass in class TypeMappingpublic final boolean isFiltered(Object entity)
TypeMappingisFiltered in class TypeMappingtrue if entity must not be persisted to indexpublic final Id getId(Object o)
getId in class TypeMapping#setId(Object, Object)public Long getVersion(Object o)
TypeMappinggetVersion in class TypeMappingprotected boolean filter(Type o)
public final String toIdString(Object id)
toIdString in class TypeMappingTypeMapping.toId(String)public abstract Id toId(String id)
toId in class TypeMappingTypeMapping.toIdString(Object)protected abstract Id id(Type o)
getId(Object)protected abstract Long version(Type o)
getVersion(Object)protected abstract void buildMapping(org.elasticsearch.index.mapper.object.RootObjectMapper.Builder mapperBuilder)
throws IOException
IOExceptionprotected abstract void writeObject(org.elasticsearch.common.xcontent.XContentBuilder contentBuilder,
Type o)
throws IOException
IOExceptionCopyright © 2013 Molindo GmbH. All Rights Reserved.