org.springframework.data.mongodb.repository.support
Class MappingMongoEntityInformation<T,ID extends Serializable>
java.lang.Object
org.springframework.data.repository.core.support.AbstractEntityInformation<T,ID>
org.springframework.data.mongodb.repository.support.MappingMongoEntityInformation<T,ID>
- All Implemented Interfaces:
- MongoEntityInformation<T,ID>, org.springframework.data.repository.core.EntityInformation<T,ID>, org.springframework.data.repository.core.EntityMetadata<T>
public class MappingMongoEntityInformation<T,ID extends Serializable>
- extends org.springframework.data.repository.core.support.AbstractEntityInformation<T,ID>
- implements MongoEntityInformation<T,ID>
MongoEntityInformation
implementation using a MongoPersistentEntity
instance to lookup the necessary
information. Can be configured with a custom collection to be returned which will trump the one returned by the
MongoPersistentEntity
if given.
- Author:
- Oliver Gierke
Methods inherited from class org.springframework.data.repository.core.support.AbstractEntityInformation |
getJavaType, isNew |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.data.repository.core.EntityInformation |
isNew |
Methods inherited from interface org.springframework.data.repository.core.EntityMetadata |
getJavaType |
MappingMongoEntityInformation
public MappingMongoEntityInformation(MongoPersistentEntity<T> entity)
- Creates a new
MappingMongoEntityInformation
for the given MongoPersistentEntity
.
- Parameters:
entity
- must not be null.
MappingMongoEntityInformation
public MappingMongoEntityInformation(MongoPersistentEntity<T> entity,
String customCollectionName)
- Creates a new
MappingMongoEntityInformation
for the given MongoPersistentEntity
and custom
collection name.
- Parameters:
entity
- must not be null.customCollectionName
-
getId
public ID getId(T entity)
- Specified by:
getId
in interface org.springframework.data.repository.core.EntityInformation<T,ID extends Serializable>
getIdType
public Class<ID> getIdType()
- Specified by:
getIdType
in interface org.springframework.data.repository.core.EntityInformation<T,ID extends Serializable>
getCollectionName
public String getCollectionName()
- Description copied from interface:
MongoEntityInformation
- Returns the name of the collection the entity shall be persisted to.
- Specified by:
getCollectionName
in interface MongoEntityInformation<T,ID extends Serializable>
- Returns:
getIdAttribute
public String getIdAttribute()
- Description copied from interface:
MongoEntityInformation
- Returns the attribute that the id will be persisted to.
- Specified by:
getIdAttribute
in interface MongoEntityInformation<T,ID extends Serializable>
- Returns:
Copyright © 2012. All Rights Reserved.