当前位置: 首页>>代码示例>>Java>>正文


Java SimpleTypeHolder类代码示例

本文整理汇总了Java中org.springframework.data.mapping.model.SimpleTypeHolder的典型用法代码示例。如果您正苦于以下问题:Java SimpleTypeHolder类的具体用法?Java SimpleTypeHolder怎么用?Java SimpleTypeHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleTypeHolder类属于org.springframework.data.mapping.model包,在下文中一共展示了SimpleTypeHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TarantoolPersistentPropertyImpl

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
public TarantoolPersistentPropertyImpl(Field field, PropertyDescriptor propertyDescriptor, TarantoolPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
    super(field, propertyDescriptor, owner, simpleTypeHolder);

    this.tupleIndex = Optional.ofNullable(findPropertyOrOwnerAnnotation(Tuple.class))
            .map(Tuple::index)
            .orElse(null);

    if(tupleIndex != null) {
        Assert.isTrue(tupleIndex >= 0, "Tuple index cannot be negative");
    }

    this.spaceName =
            Optional.ofNullable(findPropertyOrOwnerAnnotation(Index.class))
            .map(Index::value)
            .orElse(null);

    if(spaceName != null) {
        Assert.hasText(spaceName, "Space index cannot be negative");
    }

    if(isIdProperty()) {
        Assert.isTrue(tupleIndex != null, "Id property must have tuple index");
    }
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:25,代码来源:TarantoolPersistentPropertyImpl.java

示例2: CustomConversions

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:yiduwangkai,项目名称:dubbox-solr,代码行数:31,代码来源:CustomConversions.java

示例3: SimpleCratePersistentProperty

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
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()));
	}
}
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:21,代码来源:SimpleCratePersistentProperty.java

示例4: CustomConversions

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:KPTechnologyLab,项目名称:spring-data-crate,代码行数:25,代码来源:CustomConversions.java

示例5: createPersistentProperty

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Override
public DocumentDbPersistentProperty createPersistentProperty(Field field, PropertyDescriptor propertyDescriptor,
                                                             BasicDocumentDbPersistentEntity<?> owner,
                                                             SimpleTypeHolder simpleTypeHolder) {
    return new BasicDocumentDbPersistentProperty(field, propertyDescriptor, owner,
            simpleTypeHolder);
}
 
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:8,代码来源:DocumentDbMappingContext.java

示例6: createPersistentProperty

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Override
protected TarantoolPersistentPropertyImpl createPersistentProperty(Field field,
                                                                   PropertyDescriptor descriptor,
                                                                   TarantoolPersistentEntity<?> owner,
                                                                   SimpleTypeHolder simpleTypeHolder) {
    return new TarantoolPersistentPropertyImpl(field, descriptor, owner, simpleTypeHolder);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:8,代码来源:TarantoolMappingContext.java

示例7: CustomConversions

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
/**
 * Creates a new {@link CustomConversions} instance registering the given converters.
 *
 * @param converters
 */
public CustomConversions(List<?> converters) {

    Assert.notNull(converters);

    this.readingPairs = new LinkedHashSet<ConvertiblePair>();
    this.writingPairs = new LinkedHashSet<ConvertiblePair>();
    this.customSimpleTypes = new HashSet<Class<?>>();
    this.customReadTargetTypes = new ConcurrentHashMap<ConvertiblePair, CacheValue<Class<?>>>();
    this.customWriteTargetTypes = new ConcurrentHashMap<ConvertiblePair, CacheValue<Class<?>>>();
    this.rawWriteTargetTypes = new ConcurrentHashMap<Class<?>, CacheValue<Class<?>>>();

    List<Object> toRegister = new ArrayList<Object>();

    // Add user provided converters to make sure they can override the defaults
    toRegister.addAll(converters);

    toRegister.add(new BinaryConverters.EnumToStringConverter());
    toRegister.add(new BinaryConverters.StringToEnumConverterFactory());
    toRegister.add(new BinaryConverters.DateToNumberConverter());
    toRegister.add(new BinaryConverters.NumberToDateConverter());

    for (Object c : toRegister) {
        registerConversion(c);
    }

    Collections.reverse(toRegister);

    this.converters = Collections.unmodifiableList(toRegister);
    this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, true);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:36,代码来源:CustomConversions.java

示例8: should_return_the_attribute_name

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test public void
should_return_the_attribute_name(){
	
	MongoPersistentEntity<FieldWithoutAnnotation> entity = new BasicMongoPersistentEntity<FieldWithoutAnnotation>(ClassTypeInformation.from(FieldWithoutAnnotation.class));
	java.lang.reflect.Field field = ReflectionUtils.findField(FieldWithoutAnnotation.class, "name");
	
	BasicMongoPersistentProperty persistentProperty = new BasicMongoPersistentProperty(field, null, entity, new SimpleTypeHolder());		
	String fieldName = persistentProperty.getFieldName();
	
	assertEquals("Class attribute reading failed", field.getName(), fieldName);
}
 
开发者ID:wesley-ramos,项目名称:spring-multitenancy,代码行数:12,代码来源:BasicMongoPersistentPropertyTest.java

示例9: should_return_the_name_using_the_annotation

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test public void
should_return_the_name_using_the_annotation(){
	
	MongoPersistentEntity<AnnotatedField> entity = new BasicMongoPersistentEntity<AnnotatedField>(ClassTypeInformation.from(AnnotatedField.class));
	java.lang.reflect.Field field = ReflectionUtils.findField(AnnotatedField.class, "name");
	
	BasicMongoPersistentProperty persistentProperty = new BasicMongoPersistentProperty(field, null, entity, new SimpleTypeHolder());		
	String fieldName = persistentProperty.getFieldName();
	
	assertEquals("Class attribute reading failed","name_user", fieldName);
}
 
开发者ID:wesley-ramos,项目名称:spring-multitenancy,代码行数:12,代码来源:BasicMongoPersistentPropertyTest.java

示例10: BasicCloudantPersistentProperty

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
public BasicCloudantPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, PersistentEntity<?, CloudantPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) {
    super(field, propertyDescriptor, owner, simpleTypeHolder);
    this.fieldNamingStrategy = fieldNamingStrategy == null ? PropertyNameFieldNamingStrategy.INSTANCE : fieldNamingStrategy;

    if (isIdProperty() && getFieldName() != ID_FIELD_NAME) {
        LOG.warn("Custom field name for id property is not supported!");
    }
}
 
开发者ID:SeniorAdvisor,项目名称:spring-data-cloudant,代码行数:9,代码来源:BasicCloudantPersistentProperty.java

示例11: CustomConversions

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
/**
 * 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(StringToGeoLocationConverter.INSTANCE);
	this.converters.add(GeoLocationToStringConverter.INSTANCE);
	this.converters.add(StringToPointConverter.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);
	}
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:32,代码来源:CustomConversions.java

示例12: testIdType

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test
public void testIdType() throws NoSuchFieldException, SecurityException {
	Mockito.when(persistentEntity.getTypeInformation()).thenReturn(ClassTypeInformation.from(ProductBean.class));
	SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(ProductBean.class.getDeclaredField("id"),
			null, persistentEntity, new SimpleTypeHolder());
	Mockito.when(persistentEntity.getIdProperty()).thenReturn(property);

	SolrEntityInformation<ProductBean, String> entityInformation = new MappingSolrEntityInformation<ProductBean, String>(
			persistentEntity);
	Assert.assertEquals(String.class, entityInformation.getIdType());
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:12,代码来源:MappingSolrEntityInformationTests.java

示例13: testIdTypeWithLongIdFieldType

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test
public void testIdTypeWithLongIdFieldType() throws NoSuchFieldException, SecurityException {
	Mockito.when(persistentEntityWithLongIdFieldType.getTypeInformation()).thenReturn(
			ClassTypeInformation.from(ProductBeanWithLongIdFieldType.class));

	SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(
			ProductBeanWithLongIdFieldType.class.getDeclaredField("id"), null, persistentEntityWithLongIdFieldType,
			new SimpleTypeHolder());
	Mockito.when(persistentEntityWithLongIdFieldType.getIdProperty()).thenReturn(property);

	SolrEntityInformation<ProductBeanWithLongIdFieldType, Long> entityInformation = new MappingSolrEntityInformation<ProductBeanWithLongIdFieldType, Long>(
			persistentEntityWithLongIdFieldType);
	Assert.assertEquals(Long.class, entityInformation.getIdType());
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:15,代码来源:MappingSolrEntityInformationTests.java

示例14: testGetIdAttribute

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test
public void testGetIdAttribute() throws NoSuchFieldException, SecurityException {
	Mockito.when(persistentEntity.getTypeInformation()).thenReturn(ClassTypeInformation.from(ProductBean.class));
	SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(ProductBean.class.getDeclaredField("id"),
			null, persistentEntity, new SimpleTypeHolder());
	Mockito.when(persistentEntity.getIdProperty()).thenReturn(property);

	SolrEntityInformation<ProductBean, String> entityInformation = new MappingSolrEntityInformation<ProductBean, String>(
			persistentEntity);
	Assert.assertEquals("id", entityInformation.getIdAttribute());
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:12,代码来源:MappingSolrEntityInformationTests.java

示例15: testGetIdAttributeForAlternateFieldName

import org.springframework.data.mapping.model.SimpleTypeHolder; //导入依赖的package包/类
@Test
public void testGetIdAttributeForAlternateFieldName() throws NoSuchFieldException, SecurityException {
	Mockito.when(persistentEntityWithAlternateFieldNameForId.getTypeInformation()).thenReturn(
			ClassTypeInformation.from(ProductBeanWithAlternateFieldNameForId.class));

	SimpleSolrPersistentProperty property = new SimpleSolrPersistentProperty(
			ProductBeanWithAlternateFieldNameForId.class.getDeclaredField("productId"), null,
			persistentEntityWithAlternateFieldNameForId, new SimpleTypeHolder());
	Mockito.when(persistentEntityWithAlternateFieldNameForId.getIdProperty()).thenReturn(property);

	SolrEntityInformation<ProductBeanWithAlternateFieldNameForId, String> entityInformation = new MappingSolrEntityInformation<ProductBeanWithAlternateFieldNameForId, String>(
			persistentEntityWithAlternateFieldNameForId);
	Assert.assertEquals("product_id", entityInformation.getIdAttribute());
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:15,代码来源:MappingSolrEntityInformationTests.java


注:本文中的org.springframework.data.mapping.model.SimpleTypeHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。