private void initializeComponentType() { final Class type = getType(); final Class ownerClass = getOwner().getJavaClass(); if(Map.class.isAssignableFrom(type)) { this.componentType = MappingUtils.getGenericTypeForMapProperty(ownerClass, getName(), false ); } else if(Collection.class.isAssignableFrom(type)) { this.componentType = MappingUtils.getGenericTypeForProperty(ownerClass, getName() ); } else if(type.isArray()) { this.componentType = type.getComponentType(); } if(componentType == null) { List<Map> maps = ClassPropertyFetcher.getStaticPropertyValuesFromInheritanceHierarchy(ownerClass, GormProperties.HAS_MANY, Map.class); for (Map map : maps) { if(map.containsKey(getName())) { final Object o = map.get(getName()); if(o instanceof Class) { this.componentType = (Class) o; break; } } } if(componentType == null) { this.componentType = Object.class; } } }
public Basic(PersistentEntity owner, MappingContext context, PropertyDescriptor descriptor) { super(owner, context, descriptor); initializeComponentType(); }
Map nativeMap = (Map) entryValue; LinkedHashMap targetMap = new LinkedHashMap(); Class propertyType = prop.getType(); Class genericType = prop.getComponentType(); if (genericType != null) { ConversionService conversionService = getMappingContext().getConversionService(); Collection collection = MappingUtils.createConcreteCollection(prop.getType()); Class propertyType = prop.getType(); Class genericType = prop.getComponentType(); Collection collectionValue = (Collection) entryValue; if (genericType != null) {
typeName = basic.getComponentType().getName();
CustomTypeMarshaller customTypeMarshaller = basic.getCustomTypeMarshaller(); if(customTypeMarshaller != null) { if (!customTypeMarshaller.supports(getMappingContext())) {
basic.setCustomTypeMarshaller(customTypeMarshaller);
final Class<?> referencedType = ((Basic)property).getComponentType(); String className = referencedType.getName(); final boolean isEnum = referencedType.isEnum();
CustomTypeMarshaller customTypeMarshaller = basic.getCustomTypeMarshaller(); if (customTypeMarshaller != null && customTypeMarshaller.supports(getMappingContext())) { Object propValue = entityAccess.getProperty(prop.getName());
public Basic(PersistentEntity owner, MappingContext context, String name, Class type) { super(owner, context, name, type); initializeComponentType(); }