Java源码示例:org.springframework.data.mapping.model.SimpleTypeHolder

示例1
/**
 * 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;
}
 
示例2
@Substitute
protected Target_AbstractMappingContext()  {
	this.persistentPropertyPathFactory = new PersistentPropertyPathFactory<E, P>((AbstractMappingContext)(Object)this);

	EntityInstantiators instantiators = new EntityInstantiators();
	Target_BeanWrapperPropertyAccessorFactory accessorFactory = Target_BeanWrapperPropertyAccessorFactory.INSTANCE;

	this.persistentPropertyAccessorFactory = new InstantiationAwarePropertyAccessorFactory(accessorFactory,
			instantiators);

	NONE = Optional.empty();
	persistentEntities = new HashMap<>();
	evaluationContextProvider = EvaluationContextProvider.DEFAULT;
	initialEntitySet = new HashSet<>();
	strict = false;
	simpleTypeHolder = SimpleTypeHolder.DEFAULT;
	lock = new ReentrantReadWriteLock();
	read = lock.readLock();
	write = lock.writeLock();
}
 
示例3
/**
 * 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));
}
 
示例4
public SimpleCratePersistentProperty(Field field, PropertyDescriptor propertyDescriptor, 
									 PersistentEntity<?, CratePersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
	super(field, propertyDescriptor, owner, simpleTypeHolder);
	
	this.fieldNamingStrategy = INSTANCE;

	String fieldName = getFieldName();
	
	if(RESERVED_ID_FIELD_NAME.equals(fieldName)) {				
		throw new MappingException(format(RESERVED_ID, fieldName, owner.getType()));
	}
	
	if(RESERVED_VESRION_FIELD_NAME.equals(fieldName)) {				
		throw new MappingException(format(RESERVED_VERSION, fieldName, owner.getType()));
	}
	
	if(startsWithIgnoreCase(fieldName, "_")) {
		throw new MappingException(format(STARTS_WITH_UNDERSCORE, fieldName, owner.getType()));
	}
}
 
示例5
/**
 * Create a new instance with a given list of converters.
 * @param converters the list of custom converters.
 */
public CustomConversions(final List<?> converters) {
  notNull(converters);

  readingPairs = new LinkedHashSet<>();
  writingPairs = new LinkedHashSet<>();
  customSimpleTypes = new HashSet<>();
  customReadTargetTypes = new ConcurrentHashMap<>();

  this.converters = new ArrayList<>();
  this.converters.addAll(converters);
  this.converters.add(LocaleToStringConverter.INSTANCE);
  this.converters.add(DateToLongConverter.INSTANCE);
  this.converters.add(LongToDateConverter.INSTANCE);
  
  for (Object converter : this.converters) {
    registerConversion(converter);
  }

  simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, HOLDER);
}
 
示例6
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;
}
 
示例7
@Override
protected ArangoPersistentProperty createPersistentProperty(
	final Property property,
	final DefaultArangoPersistentEntity<?> owner,
	final SimpleTypeHolder simpleTypeHolder) {
	return new DefaultArangoPersistentProperty(property, owner, simpleTypeHolder, fieldNamingStrategy);
}
 
示例8
/**
 * Create new instance registering given converters
 *
 * @param converters
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public CustomConversions(List converters) {
	this.converters = (converters != null ? new ArrayList<Object>(converters) : new ArrayList<Object>());
	this.readingPairs = new HashSet<ConvertiblePair>();
	this.writingPairs = new HashSet<ConvertiblePair>();
	this.customSimpleTypes = new HashSet<Class<?>>();

	this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, SolrSimpleTypes.HOLDER);

	this.converters.add(GeoConverters.StringToPointConverter.INSTANCE);
	this.converters.add(GeoConverters.Point3DToStringConverter.INSTANCE);
	this.converters.add(new SolrjConverters.UpdateToSolrInputDocumentConverter());

	// Register Joda-Time converters only if Joda-Time was found in the
	// classpath.
	if (VersionUtil.isJodaTimeAvailable()) {
		this.converters.add(DateTimeConverters.DateToJodaDateTimeConverter.INSTANCE);
		this.converters.add(DateTimeConverters.JodaDateTimeToDateConverter.INSTANCE);
		this.converters.add(DateTimeConverters.DateToLocalDateTimeConverter.INSTANCE);
		this.converters.add(DateTimeConverters.JodaLocalDateTimeToDateConverter.INSTANCE);
	}

	for (Object converter : this.converters) {
		registerConversion(converter);
	}
}
 
示例9
/**
 * 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();
}
 
示例10
@Override
protected Neo4jPersistentProperty createPersistentProperty(Property property,
	Neo4jPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {

	return new DefaultNeo4jPersistentProperty(property, owner, this, simpleTypeHolder);
}
 
示例11
public SimpleSolrPersistentProperty(Field field, PropertyDescriptor propertyDescriptor,
		PersistentEntity<?, SolrPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
	super(field, propertyDescriptor, owner, simpleTypeHolder);
}
 
示例12
@Override
protected SolrPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor,
		SimpleSolrPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new SimpleSolrPersistentProperty(field, descriptor, owner, simpleTypeHolder);
}
 
示例13
@Override
public CosmosPersistentProperty createPersistentProperty(Property property,
                                                         BasicCosmosPersistentEntity<?> owner,
                                                         SimpleTypeHolder simpleTypeHolder) {
    return new BasicCosmosPersistentProperty(property, owner, simpleTypeHolder);
}
 
示例14
public BasicCosmosPersistentProperty(Property property, CosmosPersistentEntity<?> owner,
                                     SimpleTypeHolder simpleTypeHolder) {
    super(property, owner, simpleTypeHolder);
}
 
示例15
@Override
protected DatastorePersistentProperty createPersistentProperty(Property property,
		DatastorePersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new DatastorePersistentPropertyImpl(property, owner, simpleTypeHolder,
			this.fieldNamingStrategy);
}
 
示例16
@Override
protected SpannerPersistentProperty createPersistentProperty(Property property,
		SpannerPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new SpannerPersistentPropertyImpl(property, owner, simpleTypeHolder,
			this.fieldNamingStrategy);
}
 
示例17
@Override
protected FirestorePersistentProperty createPersistentProperty(Property property,
		FirestorePersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new FirestorePersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
示例18
@Override
protected VaultPersistentProperty createPersistentProperty(Property property, VaultPersistentEntity<?> owner,
		SimpleTypeHolder simpleTypeHolder) {
	return new VaultPersistentProperty(property, owner, simpleTypeHolder);
}
 
示例19
@Override
protected MybatisPersistentProperty createPersistentProperty(Property property,
		MybatisPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new MybatisPersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
示例20
protected MybatisPersistentProperty createPersistentProperty(Property property,
		MybatisPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new MybatisPersistentPropertyImpl(property, owner, simpleTypeHolder);
}
 
示例21
@Override
protected MyPersistentProperty createPersistentProperty(Property property, MyPersistentEntity<?> owner,
		SimpleTypeHolder simpleTypeHolder) {
	return new MyPersistentProperty(property, owner, simpleTypeHolder);
}
 
示例22
MyPersistentProperty(Property property, PersistentEntity<?, MyPersistentProperty> owner,
		SimpleTypeHolder simpleTypeHolder) {
	super(property, owner, simpleTypeHolder);
}
 
示例23
@Override
protected CratePersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor,
																   SimpleCratePersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new SimpleCratePersistentProperty(field, descriptor, owner, simpleTypeHolder);
}
 
示例24
public KeyValuePersistentProperty(Property property, PersistentEntity<?, P> owner,
		SimpleTypeHolder simpleTypeHolder) {
	super(property, owner, simpleTypeHolder);
}
 
示例25
@Override
@SuppressWarnings("unchecked")
protected P createPersistentProperty(Property property, E owner, SimpleTypeHolder simpleTypeHolder) {
	return (P) new KeyValuePersistentProperty<>(property, owner, simpleTypeHolder);
}
 
示例26
@Override
protected DynamoDBPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor,
		DynamoDBPersistentEntityImpl<?> owner, SimpleTypeHolder simpleTypeHolder) {
	return new DynamoDBPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder);

}
 
示例27
/**
 * 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;
}
 
示例28
/**
 * 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);
}
 
示例29
/**
 * 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);
}
 
示例30
/**
 * Returns the simple type holder.
 *
 * @return the simple type holder.
 */
public SimpleTypeHolder getSimpleTypeHolder() {
  return simpleTypeHolder;
}