org.springframework.data.mapping.model.FieldNamingStrategy Java Examples
The following examples show how to use
org.springframework.data.mapping.model.FieldNamingStrategy.
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: BeihuMongoDataAutoConfiguration.java From beihu-boot with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public MongoMappingContext mongoMappingContext(MongoCustomConversions conversions) throws ClassNotFoundException { MongoMappingContext context = new MongoMappingContext(); context.setInitialEntitySet(new EntityScanner(this.applicationContext) .scan(Document.class, Persistent.class)); Class<?> strategyClass = this.beihuMongoProperties.getFieldNamingStrategy(); if (strategyClass != null) { context.setFieldNamingStrategy( (FieldNamingStrategy) BeanUtils.instantiateClass(strategyClass)); } context.setSimpleTypeHolder(conversions.getSimpleTypeHolder()); return context; }
Example #2
Source File: DefaultArangoPersistentProperty.java From spring-data with Apache License 2.0 | 5 votes |
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 #3
Source File: DatastorePersistentPropertyImpl.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
/** * 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 #4
Source File: SpannerMappingContextTests.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Test public void testSetFieldNamingStrategy() { SpannerMappingContext context = new SpannerMappingContext(); FieldNamingStrategy strat = mock(FieldNamingStrategy.class); context.setFieldNamingStrategy(strat); assertThat(context.getFieldNamingStrategy()).isSameAs(strat); }
Example #5
Source File: SpannerPersistentPropertyImplTests.java From spring-cloud-gcp with Apache License 2.0 | 5 votes |
@Test public void testNullColumnName() { this.expectedEx.expect(MappingException.class); // The expectMessage calls below operate as `contains` and seperate calls are used // because the printed order of some components can change randomly. this.expectedEx.expectMessage("Invalid (null or empty) field name returned for " + "property @org.springframework.cloud.gcp.data.spanner.core.mapping.PrimaryKey"); this.expectedEx.expectMessage("keyOrder=1"); this.expectedEx.expectMessage("value=1"); this.expectedEx.expectMessage( "java.lang.String org.springframework.cloud.gcp.data.spanner.core.mapping." + "SpannerPersistentPropertyImplTests$TestEntity.id by class " + "org.springframework.data.mapping.model.FieldNamingStrategy$MockitoMock$"); SpannerMappingContext context = new SpannerMappingContext(); FieldNamingStrategy namingStrat = mock(FieldNamingStrategy.class); when(namingStrat.getFieldName(any())).thenReturn(null); context.setFieldNamingStrategy(namingStrat); SpannerPersistentEntity entity = context.getPersistentEntity(TestEntity.class); for (Object col : entity.columns()) { SpannerPersistentPropertyImpl prop = (SpannerPersistentPropertyImpl) entity .getPersistentProperty((String) col); // Getting the column name will throw an exception because of the mock naming // strategy. prop.getColumnName(); } }
Example #6
Source File: ArangoConfiguration.java From spring-data with Apache License 2.0 | 4 votes |
default FieldNamingStrategy fieldNamingStrategy() { return PropertyNameFieldNamingStrategy.INSTANCE; }
Example #7
Source File: ArangoMappingContext.java From spring-data with Apache License 2.0 | 4 votes |
public void setFieldNamingStrategy(final FieldNamingStrategy fieldNamingStrategy) { this.fieldNamingStrategy = fieldNamingStrategy; }
Example #8
Source File: MybatisPersistentEntityImpl.java From spring-data-mybatis with Apache License 2.0 | 4 votes |
public void setGlobalFieldNamingStrategy( FieldNamingStrategy globalFieldNamingStrategy) { this.globalFieldNamingStrategy = globalFieldNamingStrategy; }
Example #9
Source File: MybatisMapperBuildAssistant.java From spring-data-mybatis with Apache License 2.0 | 4 votes |
public void setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) { this.fieldNamingStrategy = fieldNamingStrategy; }
Example #10
Source File: MongoPersistenceConfiguration.java From omh-dsu-ri with Apache License 2.0 | 4 votes |
/** * @return a naming strategy that makes persisted data match serialized data by converting camel case fields to * snake case and respecting {@link JsonProperty} overrides */ protected FieldNamingStrategy fieldNamingStrategy() { return new JsonPropertyPreservingFieldNamingStrategy(new SnakeCaseFieldNamingStrategy()); }
Example #11
Source File: SpannerPersistentPropertyImpl.java From spring-cloud-gcp with Apache License 2.0 | 3 votes |
/** * 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 #12
Source File: SpannerMappingContext.java From spring-cloud-gcp with Apache License 2.0 | 2 votes |
/** * Set the field naming strategy used when creating persistent properties. * @param fieldNamingStrategy the field naming strategy passed used by created persistent * properties get column names. */ public void setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) { this.fieldNamingStrategy = (fieldNamingStrategy != null) ? fieldNamingStrategy : DEFAULT_NAMING_STRATEGY; }
Example #13
Source File: SpannerMappingContext.java From spring-cloud-gcp with Apache License 2.0 | 2 votes |
/** * Gets the field naming strategy used by this mapping context. * @return the field naming strategy. */ public FieldNamingStrategy getFieldNamingStrategy() { return this.fieldNamingStrategy; }
Example #14
Source File: MybatisPersistentEntity.java From spring-data-mybatis with Apache License 2.0 | votes |
FieldNamingStrategy getFieldNamingStrategy();