private void verifyFieldUniqueness() { AssertFieldNameUniquenessHandler handler = new AssertFieldNameUniquenessHandler(); doWithProperties(handler); doWithAssociations(handler); }
private static void potentiallyAssertLanguageType(MongoPersistentProperty persistentProperty) { if (persistentProperty.isExplicitLanguageProperty()) { assertPropertyType(persistentProperty, String.class); } }
@Override public Class<?> getFieldType() { if (!isIdProperty()) { return getType(); } MongoId idAnnotation = findAnnotation(MongoId.class); if (idAnnotation == null) { return FieldType.OBJECT_ID.getJavaClass(); } FieldType fieldType = idAnnotation.targetType(); if (fieldType == FieldType.IMPLICIT) { return getType(); } return fieldType.getJavaClass(); }
@Override public String getIdFieldName() { return entity.getRequiredIdProperty().getFieldName(); }
public String getIdAttribute() { return entityMetadata.getRequiredIdProperty().getName(); }
/** * Creates a new {@link MongoMappingContext}. */ public MongoMappingContext() { setSimpleTypeHolder(MongoSimpleTypes.HOLDER); }
private void verifyFieldTypes() { doWithProperties(new PropertyTypeAssertionHandler()); }
@Override public void doWithPersistentProperty(MongoPersistentProperty persistentProperty) { potentiallyAssertTextScoreType(persistentProperty); potentiallyAssertLanguageType(persistentProperty); potentiallyAssertDBRefTargetType(persistentProperty); }
public int getFieldOrder() { org.springframework.data.mongodb.core.mapping.Field annotation = findAnnotation( org.springframework.data.mongodb.core.mapping.Field.class); return annotation != null ? annotation.order() : Integer.MAX_VALUE; }
private static void potentiallyAssertTextScoreType(MongoPersistentProperty persistentProperty) { if (persistentProperty.isTextScoreProperty()) { assertPropertyType(persistentProperty, Float.class, Double.class); } }
@Override public boolean isAssociation() { if (this.isAssociation == null) { this.isAssociation = super.isAssociation(); } return this.isAssociation; }
@Override public MongoPersistentProperty createPersistentProperty(Property property, BasicMongoPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) { return new CachingMongoPersistentProperty(property, owner, simpleTypeHolder, fieldNamingStrategy); }
@Override public boolean isTextScoreProperty() { return isAnnotationPresent(TextScore.class); } }
@Override public String getFieldName() { if (this.fieldName == null) { this.fieldName = super.getFieldName(); } return this.fieldName; }
@Override public Class<?> getFieldType() { if (this.fieldType == null) { this.fieldType = super.getFieldType(); } return this.fieldType; }
@Override public boolean isTransient() { if (this.isTransient == null) { this.isTransient = super.isTransient(); } return this.isTransient; }
@Override public DBRef getDBRef() { if (!dbRefResolved) { this.dbref = super.getDBRef(); this.dbRefResolved = true; } return this.dbref; } }
@Override public boolean isIdProperty() { if (this.isIdProperty == null) { this.isIdProperty = super.isIdProperty(); } return this.isIdProperty; }
@Override public boolean usePropertyAccess() { if (this.usePropertyAccess == null) { this.usePropertyAccess = super.usePropertyAccess(); } return this.usePropertyAccess; }