T
- The type of the class the ClassModel representspublic class ClassModelBuilder<T> extends Object
ClassModels
.ClassModel
Modifier and Type | Method and Description |
---|---|
ClassModelBuilder<T> |
annotations(List<Annotation> annotations)
Sets the annotations for the model
|
ClassModel<T> |
build()
Creates a new ClassModel instance based on the mapping data provided.
|
ClassModelBuilder<T> |
conventions(List<Convention> conventions)
Sets the conventions to apply to the model
|
ClassModelBuilder<T> |
discriminator(String discriminator)
Sets the discriminator to be used when storing instances of the modeled type
|
ClassModelBuilder<T> |
discriminatorKey(String discriminatorKey)
Sets the discriminator key to be used when storing instances of the modeled type
|
ClassModelBuilder<T> |
enableDiscriminator(boolean discriminatorEnabled)
Enables or disables the use of a discriminator when serializing
|
List<Annotation> |
getAnnotations() |
List<Convention> |
getConventions() |
String |
getDiscriminator() |
String |
getDiscriminatorKey() |
FieldModelBuilder<?> |
getField(String name)
Gets a field by the given name.
|
List<FieldModelBuilder<?>> |
getFields() |
String |
getIdField() |
InstanceCreatorFactory<T> |
getInstanceCreatorFactory() |
Class<T> |
getType() |
ClassModelBuilder<T> |
idField(String idField)
Designates a field as the
_id field for this type. |
ClassModelBuilder<T> |
instanceCreatorFactory(InstanceCreatorFactory<T> instanceCreatorFactory)
Sets the InstanceCreatorFactory for the ClassModel
|
boolean |
removeField(String name)
Remove a field from the builder
|
String |
toString() |
ClassModelBuilder<T> |
type(Class<T> type)
Sets the type of the model
|
Boolean |
useDiscriminator() |
public ClassModelBuilder<T> instanceCreatorFactory(InstanceCreatorFactory<T> instanceCreatorFactory)
instanceCreatorFactory
- the InstanceCreatorFactorypublic InstanceCreatorFactory<T> getInstanceCreatorFactory()
public ClassModelBuilder<T> type(Class<T> type)
type
- the type of the classpublic ClassModelBuilder<T> conventions(List<Convention> conventions)
conventions
- a list of conventionspublic List<Convention> getConventions()
public ClassModelBuilder<T> annotations(List<Annotation> annotations)
annotations
- a list of annotationspublic List<Annotation> getAnnotations()
public ClassModelBuilder<T> discriminator(String discriminator)
discriminator
- the discriminator valuepublic String getDiscriminator()
public ClassModelBuilder<T> discriminatorKey(String discriminatorKey)
discriminatorKey
- the discriminator key valuepublic String getDiscriminatorKey()
public ClassModelBuilder<T> enableDiscriminator(boolean discriminatorEnabled)
discriminatorEnabled
- true to enable the use of a discriminatorpublic Boolean useDiscriminator()
public ClassModelBuilder<T> idField(String idField)
_id
field for this type. If another field is currently marked as the _id
field,
that setting is cleared in favor of the named field.idField
- the FieldModel field name to use for the _id
fieldpublic String getIdField()
_id
field for this type or null if not setpublic boolean removeField(String name)
name
- the actual field name in the POJO and not the documentFieldName
.public FieldModelBuilder<?> getField(String name)
Note: Searches against the actual field name in the POJO and not the documentFieldName
.
name
- the name of the field to find.public List<FieldModelBuilder<?>> getFields()
public ClassModel<T> build()