if (value != null) { Collection<Object> collection; if (List.class == ctx.getType()) { collection = new ArrayList<Object>(); } else if (Set.class == ctx.getType()) { collection = new HashSet<Object>(); } else { throw new IllegalArgumentException(ctx.getType().getName()); if (isValueType(ctx.getElementType()) || isEntityType(ctx.getElementType())) { ctx.set(collection);
elementType = ((CollectionPropertyContext) ctx).getElementType();
elementType = ((CollectionPropertyContext) ctx).getElementType();
elementType = ((CollectionPropertyContext) ctx).getElementType();
if (value != null) { Collection<Object> collection; if (List.class == ctx.getType()) { collection = new ArrayList<Object>(); } else if (Set.class == ctx.getType()) { collection = new HashSet<Object>(); } else { throw new IllegalArgumentException(ctx.getType().getName()); if (isValueType(ctx.getElementType()) || isEntityType(ctx.getElementType())) { ctx.set(collection);
if (value != null) { Collection<Object> collection; if (List.class == ctx.getType()) { collection = new ArrayList<Object>(); } else if (Set.class == ctx.getType()) { collection = new HashSet<Object>(); } else { throw new IllegalArgumentException(ctx.getType().getName()); if (isValueType(ctx.getElementType()) || isEntityType(ctx.getElementType())) { ctx.set(collection);
if (value != null) { Collection<Object> collection; if (List.class == ctx.getType()) { collection = new ArrayList<Object>(); } else if (Set.class == ctx.getType()) { collection = new HashSet<Object>(); } else { throw new IllegalArgumentException(ctx.getType().getName()); if (isValueType(ctx.getElementType()) || isEntityType(ctx.getElementType())) { ctx.set(collection);
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { // containsKey to distinguish null from unknown if (flatValueMap.containsKey(propertyName)) { Object resolved = null; // The null check on getKeyType() is necessary as some of the given PropertyContext's // implement both MapPropertyContext and CollectionPropertyContext. if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); Object newValue = EntityCodex.decode(state, mapCtx.getType(), keyType, valueType, flatValueMap.get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; Object newValue = EntityCodex.decode(state, ctx.getType(), elementType, flatValueMap .get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } service.setProperty(domain, propertyName, service.resolveDomainClass(ctx.getType()), resolved); } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { // containsKey to distinguish null from unknown if (flatValueMap.containsKey(propertyName)) { Object resolved = null; // The null check on getKeyType() is necessary as some of the given PropertyContext's // implement both MapPropertyContext and CollectionPropertyContext. if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); Object newValue = EntityCodex.decode(state, mapCtx.getType(), keyType, valueType, flatValueMap.get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; Object newValue = EntityCodex.decode(state, ctx.getType(), elementType, flatValueMap .get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } service.setProperty(domain, propertyName, service.resolveDomainClass(ctx.getType()), resolved); } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { // containsKey to distinguish null from unknown if (flatValueMap.containsKey(propertyName)) { Object resolved = null; // The null check on getKeyType() is necessary as some of the given PropertyContext's // implement both MapPropertyContext and CollectionPropertyContext. if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); Object newValue = EntityCodex.decode(state, mapCtx.getType(), keyType, valueType, flatValueMap.get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; Object newValue = EntityCodex.decode(state, ctx.getType(), elementType, flatValueMap .get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } service.setProperty(domain, propertyName, service.resolveDomainClass(ctx.getType()), resolved); } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { if (ctx.canSet()) { if (properties.containsKey(propertyName)) { Splittable raw = properties.get(propertyName); Object decoded = null; if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); decoded = EntityCodex.decode(AbstractRequestContext.this, mapCtx.getType(), keyType, valueType, raw); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; decoded = EntityCodex.decode(AbstractRequestContext.this, ctx.getType(), elementType, raw); } ctx.set(decoded); } } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { if (ctx.canSet()) { if (properties.containsKey(propertyName)) { Splittable raw = properties.get(propertyName); Object decoded = null; if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); decoded = EntityCodex.decode(AbstractRequestContext.this, mapCtx.getType(), keyType, valueType, raw); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; decoded = EntityCodex.decode(AbstractRequestContext.this, ctx.getType(), elementType, raw); } ctx.set(decoded); } } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { if (ctx.canSet()) { if (properties.containsKey(propertyName)) { Splittable raw = properties.get(propertyName); Object decoded = null; if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); decoded = EntityCodex.decode(AbstractRequestContext.this, mapCtx.getType(), keyType, valueType, raw); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; decoded = EntityCodex.decode(AbstractRequestContext.this, ctx.getType(), elementType, raw); } ctx.set(decoded); } } return false; }
@Override public void endVisitCollectionProperty(String propertyName, AutoBean<Collection<?>> value, CollectionPropertyContext ctx) { if (value == null) { return; } if (isEntityType(ctx.getElementType()) || isValueType(ctx.getElementType())) { for (Object o : value.as()) { serialize((BaseProxy) o); } } }
@Override public void endVisitCollectionProperty(String propertyName, AutoBean<Collection<?>> value, CollectionPropertyContext ctx) { if (value == null) { return; } if (isEntityType(ctx.getElementType()) || isValueType(ctx.getElementType())) { for (Object o : value.as()) { serialize((BaseProxy) o); } } }
@Override public void endVisitCollectionProperty(String propertyName, AutoBean<Collection<?>> value, CollectionPropertyContext ctx) { if (value == null) { return; } if (isEntityType(ctx.getElementType()) || isValueType(ctx.getElementType())) { for (Object o : value.as()) { serialize((BaseProxy) o); } } }
elementType = ((CollectionPropertyContext) ctx).getElementType();
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { if (ctx.canSet()) { if (properties.containsKey(propertyName)) { Splittable raw = properties.get(propertyName); Object decoded = null; if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); decoded = EntityCodex.decode(AbstractRequestContext.this, mapCtx.getType(), keyType, valueType, raw); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; decoded = EntityCodex.decode(AbstractRequestContext.this, ctx.getType(), elementType, raw); } ctx.set(decoded); } } return false; }
@Override public boolean visitReferenceProperty(String propertyName, AutoBean<?> value, PropertyContext ctx) { // containsKey to distinguish null from unknown if (flatValueMap.containsKey(propertyName)) { Object resolved = null; // The null check on getKeyType() is necessary as some of the given PropertyContext's // implement both MapPropertyContext and CollectionPropertyContext. if (ctx.getType() == Map.class) { MapPropertyContext mapCtx = (MapPropertyContext) ctx; Class<?> keyType = mapCtx.getKeyType(); Class<?> valueType = mapCtx.getValueType(); Object newValue = EntityCodex.decode(state, mapCtx.getType(), keyType, valueType, flatValueMap.get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } else { Class<?> elementType = ctx instanceof CollectionPropertyContext ? ((CollectionPropertyContext) ctx) .getElementType() : null; Object newValue = EntityCodex.decode(state, ctx.getType(), elementType, flatValueMap .get(propertyName)); resolved = state.getResolver().resolveDomainValue(newValue, false); } service.setProperty(domain, propertyName, service.resolveDomainClass(ctx.getType()), resolved); } return false; }
@Override public void endVisitCollectionProperty(String propertyName, AutoBean<Collection<?>> value, CollectionPropertyContext ctx) { if (value == null) { return; } if (isEntityType(ctx.getElementType()) || isValueType(ctx.getElementType())) { for (Object o : value.as()) { serialize((BaseProxy) o); } } }