Package org.bson.codecs.pojo
Class ClassModel<T>
-
- org.bson.codecs.pojo.ClassModel<T>
-
- Type Parameters:
T
- The type of the class the ClassModel represents
public final class ClassModel<T> extends
This model represents the metadata for a class and all its properties.- Since:
- 3.5
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <S> ClassModelBuilder<S>
<S> type)
Creates a new Class Model builder instance using reflection.boolean
o)
getDiscriminator()
Returns the discriminator key.getDiscriminatorKey()
Gets the value for the discriminator.PropertyModel<?>
getIdPropertyModel()
Returns thePropertyModel
mapped as the id property for this ClassModelgetName()
Returns the name of the class represented by this ClassModelPropertyModel<?>
propertyName)
Gets aPropertyModel
by the property name.<PropertyModel<?>>
getPropertyModels()
Returns all the properties on this model<T>
getType()
int
hashCode()
boolean
hasTypeParameters()
toString()
boolean
useDiscriminator()
-
-
-
Method Detail
-
builder
public static <S> <S> type)
Creates a new Class Model builder instance using reflection.- Type Parameters:
S
- the type of the class- Parameters:
type
- the POJO class to reflect and configure the builder with.- Returns:
- a new Class Model builder instance using reflection on the
clazz
.
-
getType
public <T> getType()
- Returns:
- the backing class for the ClassModel
-
hasTypeParameters
public boolean hasTypeParameters()
- Returns:
- true if the underlying type has type parameters.
-
useDiscriminator
public boolean useDiscriminator()
- Returns:
- true if a discriminator should be used when storing the data.
-
getDiscriminatorKey
public getDiscriminatorKey()
Gets the value for the discriminator.- Returns:
- the discriminator value or null if not set
-
getDiscriminator
public getDiscriminator()
Returns the discriminator key.- Returns:
- the discriminator key or null if not set
-
getPropertyModel
public propertyName)
Gets aPropertyModel
by the property name.- Parameters:
propertyName
- the PropertyModel's property name- Returns:
- the PropertyModel or null if the property is not found
-
getPropertyModels
public <PropertyModel<?>> getPropertyModels()
Returns all the properties on this model- Returns:
- the list of properties
-
getIdPropertyModel
public PropertyModel<?> getIdPropertyModel()
Returns thePropertyModel
mapped as the id property for this ClassModel- Returns:
- the PropertyModel for the id
-
getName
public getName()
Returns the name of the class represented by this ClassModel- Returns:
- the name
-
toString
public toString()
- Overrides:
in class
-
equals
public boolean equals( o)
- Overrides:
in class
-
hashCode
public int hashCode()
- Overrides:
in class
-
-