@SuppressWarnings({"unchecked", "rawtypes"}) private DeployBeanProperty createManyType( DeployBeanDescriptor<?> desc, Class<?> targetType, ManyType manyType) { ScalarType<?> scalarType = typeManager.getScalarType(targetType); if (scalarType != null) { return new DeployBeanPropertySimpleCollection(desc, targetType, scalarType, manyType); } // TODO: Handle Collection of CompoundType and Embedded Type return new DeployBeanPropertyAssocMany(desc, targetType, manyType); }
@SuppressWarnings({"unchecked", "rawtypes"}) private DeployBeanProperty createManyType( DeployBeanDescriptor<?> desc, Class<?> targetType, ManyType manyType) { try { ScalarType<?> scalarType = typeManager.getScalarType(targetType); if (scalarType != null) { return new DeployBeanPropertySimpleCollection(desc, targetType, scalarType, manyType); } } catch (NullPointerException e) { logger.debug("expected non-scalar type" + e.getMessage()); } // TODO: Handle Collection of CompoundType and Embedded Type return new DeployBeanPropertyAssocMany(desc, targetType, manyType); }
@SuppressWarnings({"unchecked", "rawtypes"}) private DeployBeanProperty createProp(DeployBeanDescriptor<?> desc, Field field) { Class<?> propertyType = field.getType(); Class<?> innerType = propertyType; // check for Collection type (list, set or map) ManyType manyType = determineManyType.getManyType(propertyType); if (manyType != null) { // List, Set or Map based object Class<?> targetType = determineTargetType(field); if (targetType == null) { Transient transAnnotation = field.getAnnotation(Transient.class); if (transAnnotation != null) { // not supporting this field (generic type used) return null; } logger.warning( "Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName()); } return createManyType(desc, targetType, manyType); } if (innerType.isEnum() || innerType.isPrimitive()) { return new DeployBeanProperty(desc, propertyType, null, null); } ScalarType<?> scalarType = typeManager.getScalarType(innerType); if (scalarType != null) { return new DeployBeanProperty(desc, propertyType, scalarType, null); } CtCompoundType<?> compoundType = typeManager.getCompoundType(innerType); if (compoundType != null) { return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null); } if (!isTransientField(field)) { try { CheckImmutableResponse checkImmutable = typeManager.checkImmutable(innerType); if (checkImmutable.isImmutable()) { if (checkImmutable.isCompoundType()) { // use reflection to support compound immutable value objects typeManager.recursiveCreateScalarDataReader(innerType); compoundType = typeManager.getCompoundType(innerType); if (compoundType != null) { return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null); } } else { // use reflection to support simple immutable value objects scalarType = typeManager.recursiveCreateScalarTypes(innerType); return new DeployBeanProperty(desc, propertyType, scalarType, null); } } } catch (Exception e) { logger.log(Level.SEVERE, "Error with " + desc + " field:" + field.getName(), e); } } return new DeployBeanPropertyAssocOne(desc, propertyType); }