protected PropertyMeta parseSimpleProperty(PropertyParsingContext context) { log.debug( "Parsing property {} as simple property of entity class {}", context.getCurrentPropertyName(), context.getCurrentEntityClass().getCanonicalName()); Class<?> entityClass = context.getCurrentEntityClass(); Field field = context.getCurrentField(); boolean timeUUID = isTimeUUID(context, field); Method[] accessors = entityIntrospector.findAccessors(entityClass, field); PropertyType type = SIMPLE; PropertyMeta propertyMeta = factory() .objectMapper(context.getCurrentObjectMapper()) .type(type) .propertyName(context.getCurrentPropertyName()) .entityClassName(context.getCurrentEntityClass().getCanonicalName()) .accessors(accessors) .consistencyLevels(context.getCurrentConsistencyLevels()) .field(field) .timeuuid(timeUUID) .build(Void.class, field.getType()); log.trace( "Built simple property meta for property {} of entity class {} : {}", propertyMeta.getPropertyName(), context.getCurrentEntityClass().getCanonicalName(), propertyMeta); return propertyMeta; }
protected PropertyMeta parseCounterProperty(PropertyParsingContext context) { log.debug( "Parsing property {} as counter property of entity class {}", context.getCurrentPropertyName(), context.getCurrentEntityClass().getCanonicalName()); Class<?> entityClass = context.getCurrentEntityClass(); Field field = context.getCurrentField(); Method[] accessors = entityIntrospector.findAccessors(entityClass, field); PropertyType type = PropertyType.COUNTER; CounterProperties counterProperties = new CounterProperties(context.getCurrentEntityClass().getCanonicalName()); PropertyMeta propertyMeta = factory() .objectMapper(context.getCurrentObjectMapper()) .type(type) .propertyName(context.getCurrentPropertyName()) .entityClassName(context.getCurrentEntityClass().getCanonicalName()) .accessors(accessors) .field(field) .counterProperties(counterProperties) .consistencyLevels(context.getCurrentConsistencyLevels()) .build(Void.class, field.getType()); context.hasSimpleCounterType(); context.getCounterMetas().add(propertyMeta); if (context.isCustomConsistencyLevels()) { parseSimpleCounterConsistencyLevel(context, propertyMeta); } log.trace( "Built simple property meta for property {} of entity class {} : {}", propertyMeta.getPropertyName(), context.getCurrentEntityClass().getCanonicalName(), propertyMeta); return propertyMeta; }
protected <K, V> PropertyMeta parseMapProperty(PropertyParsingContext context) { log.debug( "Parsing property {} as map property of entity class {}", context.getCurrentPropertyName(), context.getCurrentEntityClass().getCanonicalName()); Class<?> entityClass = context.getCurrentEntityClass(); Field field = context.getCurrentField(); boolean timeUUID = isTimeUUID(context, field); validator.validateMapGenerics(field, entityClass); Pair<Class<K>, Class<V>> types = determineMapGenericTypes(field); Class<K> keyClass = types.left; Class<V> valueClass = types.right; Method[] accessors = entityIntrospector.findAccessors(entityClass, field); PropertyType type = MAP; PropertyMeta mapMeta = factory() .objectMapper(context.getCurrentObjectMapper()) .type(type) .propertyName(context.getCurrentPropertyName()) .entityClassName(context.getCurrentEntityClass().getCanonicalName()) .consistencyLevels(context.getCurrentConsistencyLevels()) .accessors(accessors) .field(field) .timeuuid(timeUUID) .build(keyClass, valueClass); log.trace( "Built map property meta for property {} of entity class {} : {}", mapMeta.getPropertyName(), context.getCurrentEntityClass().getCanonicalName(), mapMeta); return mapMeta; }
public <V> PropertyMeta parseSetProperty(PropertyParsingContext context) { log.debug( "Parsing property {} as set property of entity class {}", context.getCurrentPropertyName(), context.getCurrentEntityClass().getCanonicalName()); Class<?> entityClass = context.getCurrentEntityClass(); Field field = context.getCurrentField(); boolean timeUUID = isTimeUUID(context, field); Class<V> valueClass; Type genericType = field.getGenericType(); valueClass = inferValueClassForListOrSet(genericType, entityClass); Method[] accessors = entityIntrospector.findAccessors(entityClass, field); PropertyType type = SET; PropertyMeta setMeta = factory() .objectMapper(context.getCurrentObjectMapper()) .type(type) .propertyName(context.getCurrentPropertyName()) .entityClassName(context.getCurrentEntityClass().getCanonicalName()) .consistencyLevels(context.getCurrentConsistencyLevels()) .accessors(accessors) .field(field) .timeuuid(timeUUID) .build(Void.class, valueClass); log.trace( "Built set property meta for property {} of entity class {} : {}", setMeta.getPropertyName(), context.getCurrentEntityClass().getCanonicalName(), setMeta); return setMeta; }
protected PropertyMeta parseEmbeddedId(PropertyParsingContext context) { log.debug( "Parsing property {} as embedded id of entity class {}", context.getCurrentPropertyName(), context.getCurrentEntityClass().getCanonicalName()); Class<?> entityClass = context.getCurrentEntityClass(); Field field = context.getCurrentField(); EmbeddedId embeddedId = field.getAnnotation(EmbeddedId.class); String propertyName = StringUtils.isNotBlank(embeddedId.name()) ? embeddedId.name() : context.getCurrentPropertyName(); Method[] accessors = entityIntrospector.findAccessors(entityClass, field); PropertyType type = EMBEDDED_ID; EmbeddedIdProperties embeddedIdProperties = extractEmbeddedIdProperties(field.getType()); PropertyMeta propertyMeta = factory() .objectMapper(context.getCurrentObjectMapper()) .type(type) .propertyName(propertyName) .embeddedIdProperties(embeddedIdProperties) .entityClassName(context.getCurrentEntityClass().getCanonicalName()) .accessors(accessors) .field(field) .consistencyLevels(context.getCurrentConsistencyLevels()) .build(Void.class, field.getType()); log.trace( "Built embedded id property meta for property {} of entity class {} : {}", propertyMeta.getPropertyName(), context.getCurrentEntityClass().getCanonicalName(), propertyMeta); return propertyMeta; }