org.springframework.data.mapping.model.Property Java Examples

The following examples show how to use org.springframework.data.mapping.model.Property. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MybatisPersistentPropertyImpl.java    From spring-data-mybatis with Apache License 2.0 7 votes vote down vote up
/**
 * Creates a new {@link AnnotationBasedPersistentProperty}.
 * @param property must not be {@literal null}.
 * @param owner must not be {@literal null}.
 */
public MybatisPersistentPropertyImpl(Property property,
		PersistentEntity<?, MybatisPersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder) {

	super(property, owner, simpleTypeHolder);

	this.isAssociation = Lazy.of(() -> ASSOCIATION_ANNOTATIONS.stream()
			.anyMatch(this::isAnnotationPresent));
	this.usePropertyAccess = detectPropertyAccess();
	this.associationTargetType = detectAssociationTargetType();
	this.updateable = detectUpdatability();

	this.isIdProperty = Lazy.of(
			() -> ID_ANNOTATIONS.stream().anyMatch(it -> isAnnotationPresent(it)));
	this.isEntity = Lazy.of(getActualType().isAnnotationPresent(Entity.class));
}
 
Example #2
Source File: DefaultNeo4jPersistentProperty.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link AnnotationBasedPersistentProperty}.
 *
 * @param property         must not be {@literal null}.
 * @param owner            must not be {@literal null}.
 * @param simpleTypeHolder type holder
 */
DefaultNeo4jPersistentProperty(Property property,
	PersistentEntity<?, Neo4jPersistentProperty> owner,
	Neo4jMappingContext mappingContext,
	SimpleTypeHolder simpleTypeHolder) {

	super(property, owner, simpleTypeHolder);

	this.graphPropertyName = Lazy.of(this::computeGraphPropertyName);
	this.isAssociation = Lazy.of(() -> {

		Class<?> targetType = getActualType();
		return !(simpleTypeHolder.isSimpleType(targetType) || mappingContext.hasCustomWriteTarget(targetType));
	});
	this.mappingContext = mappingContext;
}
 
Example #3
Source File: DefaultNeo4jPersistentProperty.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
/**
 * Computes the target name of this property.
 *
 * @return A property on a node or {@literal null} if this property describes an association.
 */
@Nullable
private String computeGraphPropertyName() {

	if (this.isAssociation()) {
		return null;
	}

	org.neo4j.springframework.data.core.schema.Property propertyAnnotation =
		this.findAnnotation(org.neo4j.springframework.data.core.schema.Property.class);

	String targetName = this.getName();
	if (propertyAnnotation != null && !propertyAnnotation.name().isEmpty()
		&& propertyAnnotation.name().trim().length() != 0) {
		targetName = propertyAnnotation.name().trim();
	}

	return targetName;
}
 
Example #4
Source File: DefaultArangoPersistentProperty.java    From spring-data with Apache License 2.0 5 votes vote down vote up
public DefaultArangoPersistentProperty(final Property property,
	final PersistentEntity<?, ArangoPersistentProperty> owner, final SimpleTypeHolder simpleTypeHolder,
	final FieldNamingStrategy fieldNamingStrategy) {
	super(property, owner, simpleTypeHolder);
	this.fieldNamingStrategy = fieldNamingStrategy != null ? fieldNamingStrategy
			: PropertyNameFieldNamingStrategy.INSTANCE;
}
 
Example #5
Source File: ArangoMappingContext.java    From spring-data with Apache License 2.0 5 votes vote down vote up
@Override
protected ArangoPersistentProperty createPersistentProperty(
	final Property property,
	final DefaultArangoPersistentEntity<?> owner,
	final SimpleTypeHolder simpleTypeHolder) {
	return new DefaultArangoPersistentProperty(property, owner, simpleTypeHolder, fieldNamingStrategy);
}
 
Example #6
Source File: DatastorePersistentPropertyImpl.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 *
 * @param property the property to store
 * @param owner the entity to which this property belongs
 * @param simpleTypeHolder the type holder
 * @param fieldNamingStrategy the naming strategy used to get the column name of this
 * property
 */
DatastorePersistentPropertyImpl(Property property,
		PersistentEntity<?, DatastorePersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) {
	super(property, owner, simpleTypeHolder);
	this.fieldNamingStrategy = (fieldNamingStrategy != null)
			? fieldNamingStrategy
			: PropertyNameFieldNamingStrategy.INSTANCE;
	verify();
}
 
Example #7
Source File: KeyValueMappingContext.java    From spring-data-keyvalue with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected P createPersistentProperty(Property property, E owner, SimpleTypeHolder simpleTypeHolder) {
	return (P) new KeyValuePersistentProperty<>(property, owner, simpleTypeHolder);
}
 
Example #8
Source File: Neo4jMappingContext.java    From sdn-rx with Apache License 2.0 4 votes vote down vote up
@Override
protected Neo4jPersistentProperty createPersistentProperty(Property property,
	Neo4jPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {

	return new DefaultNeo4jPersistentProperty(property, owner, this, simpleTypeHolder);
}
 
Example #9
Source File: KeyValuePersistentProperty.java    From spring-data-keyvalue with Apache License 2.0 4 votes vote down vote up
public KeyValuePersistentProperty(Property property, PersistentEntity<?, P> owner,
		SimpleTypeHolder simpleTypeHolder) {
	super(property, owner, simpleTypeHolder);
}
 
Example #10
Source File: TypicalEntityReaderBenchmark.java    From spring-data-dev-tools with Apache License 2.0 4 votes vote down vote up
MyPersistentProperty(Property property, PersistentEntity<?, MyPersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder) {
	super(property, owner, simpleTypeHolder);
}
 
Example #11
Source File: TypicalEntityReaderBenchmark.java    From spring-data-dev-tools with Apache License 2.0 4 votes vote down vote up
@Override
protected MyPersistentProperty createPersistentProperty(Property property, MyPersistentEntity<?> owner,
		SimpleTypeHolder simpleTypeHolder) {
	return new MyPersistentProperty(property, owner, simpleTypeHolder);
}
 
Example #12
Source File: MybatisMapperBuildAssistant.java    From spring-data-mybatis with Apache License 2.0 4 votes vote down vote up
protected MybatisPersistentProperty createPersistentProperty(Property property,
		MybatisPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new MybatisPersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
Example #13
Source File: MybatisMappingContext.java    From spring-data-mybatis with Apache License 2.0 4 votes vote down vote up
@Override
protected MybatisPersistentProperty createPersistentProperty(Property property,
		MybatisPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new MybatisPersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
Example #14
Source File: VaultMappingContext.java    From spring-vault with Apache License 2.0 4 votes vote down vote up
@Override
protected VaultPersistentProperty createPersistentProperty(Property property, VaultPersistentEntity<?> owner,
		SimpleTypeHolder simpleTypeHolder) {
	return new VaultPersistentProperty(property, owner, simpleTypeHolder);
}
 
Example #15
Source File: FirestoreMappingContext.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
protected FirestorePersistentProperty createPersistentProperty(Property property,
		FirestorePersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new FirestorePersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
Example #16
Source File: SpannerMappingContext.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
protected SpannerPersistentProperty createPersistentProperty(Property property,
		SpannerPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new SpannerPersistentPropertyImpl(property, owner, simpleTypeHolder,
			this.fieldNamingStrategy);
}
 
Example #17
Source File: DatastoreMappingContext.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
protected DatastorePersistentProperty createPersistentProperty(Property property,
		DatastorePersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new DatastorePersistentPropertyImpl(property, owner, simpleTypeHolder,
			this.fieldNamingStrategy);
}
 
Example #18
Source File: BasicCosmosPersistentProperty.java    From spring-data-cosmosdb with MIT License 4 votes vote down vote up
public BasicCosmosPersistentProperty(Property property, CosmosPersistentEntity<?> owner,
                                     SimpleTypeHolder simpleTypeHolder) {
    super(property, owner, simpleTypeHolder);
}
 
Example #19
Source File: CosmosMappingContext.java    From spring-data-cosmosdb with MIT License 4 votes vote down vote up
@Override
public CosmosPersistentProperty createPersistentProperty(Property property,
                                                         BasicCosmosPersistentEntity<?> owner,
                                                         SimpleTypeHolder simpleTypeHolder) {
    return new BasicCosmosPersistentProperty(property, owner, simpleTypeHolder);
}
 
Example #20
Source File: SpannerPersistentPropertyImpl.java    From spring-cloud-gcp with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new {@link SpannerPersistentPropertyImpl}.
 *
 * @param property the property to store
 * @param owner the entity to which this property belongs
 * @param simpleTypeHolder the type holder
 * @param fieldNamingStrategy the naming strategy used to get the column name of this
 * property
 */
SpannerPersistentPropertyImpl(Property property,
		PersistentEntity<?, SpannerPersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) {
	super(property, owner, simpleTypeHolder);
	this.fieldNamingStrategy = (fieldNamingStrategy != null)
			? fieldNamingStrategy
			: PropertyNameFieldNamingStrategy.INSTANCE;
}
 
Example #21
Source File: VaultPersistentProperty.java    From spring-vault with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new {@link VaultPersistentProperty}.
 * @param property must not be {@literal null}.
 * @param owner must not be {@literal null}.
 * @param simpleTypeHolder must not be {@literal null}.
 */
public VaultPersistentProperty(Property property, PersistentEntity<?, VaultPersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder) {

	super(property, owner, simpleTypeHolder);
}
 
Example #22
Source File: FirestorePersistentPropertyImpl.java    From spring-cloud-gcp with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor.
 *
 * @param property the property to store
 * @param owner the entity to which this property belongs
 * @param simpleTypeHolder the type holder
 */
FirestorePersistentPropertyImpl(Property property,
		PersistentEntity<?, FirestorePersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder) {
	super(property, owner, simpleTypeHolder);
}