public boolean isExistsProperty(EventBean eventBean) { Map map = BaseNestableEventUtil.checkedCastUnderlyingMap(eventBean); return map.containsKey(propertyMap); }
public Object getFragment(EventBean obj) { Object[] array = BaseNestableEventUtil.checkedCastUnderlyingObjectArray(obj); return array[propertyIndex]; }
public Object getObjectArray(Object[] oa) throws PropertyAccessException { Object inner = oa[propertyIndex]; return BaseNestableEventUtil.getArrayPropertyAsUnderlyingsArray(underlyingType, (EventBean[]) inner); }
public Object getFragment(EventBean obj) { Object[] array = BaseNestableEventUtil.checkedCastUnderlyingObjectArray(obj); EventBean[] wrapper = (EventBean[]) array[propertyIndex]; return BaseNestableEventUtil.getBNArrayPropertyBean(wrapper, index); }
public Object getFragment(EventBean obj) { EventBean[] wrapper = (EventBean[]) BaseNestableEventUtil.checkedCastUnderlyingObjectArray(obj)[propertyIndex]; return BaseNestableEventUtil.getArrayPropertyFragment(wrapper, index, nestedGetter); }
public Object getFragment(EventBean obj) { Map<String, Object> map = BaseNestableEventUtil.checkedCastUnderlyingMap(obj); EventBean[] wrapper = (EventBean[]) map.get(propertyName); return BaseNestableEventUtil.getArrayPropertyFragment(wrapper, index, nestedGetter); }
public Object getFragment(EventBean obj) { Map<String, Object> map = BaseNestableEventUtil.checkedCastUnderlyingMap(obj); EventBean[] wrapper = (EventBean[]) map.get(propertyName); return BaseNestableEventUtil.getBNArrayPropertyBean(wrapper, index); }
/** * Compares two sets of properties and determines if they are the same, allowing for * boxed/unboxed types, and nested map types. * * @param setOne is the first set of properties * @param setTwo is the second set of properties * @param otherName name of the type compared to * @return null if the property set is equivalent or message if not */ public static ExprValidationException isDeepEqualsProperties(String otherName, Map<String, Object> setOne, Map<String, Object> setTwo) { // Should have the same number of properties if (setOne.size() != setTwo.size()) { return new ExprValidationException("Type by name '" + otherName + "' expects " + setOne.size() + " properties but receives " + setTwo.size() + " properties"); } // Compare property by property for (Map.Entry<String, Object> entry : setOne.entrySet()) { String propName = entry.getKey(); Object setTwoType = setTwo.get(entry.getKey()); boolean setTwoTypeFound = setTwo.containsKey(entry.getKey()); Object setOneType = entry.getValue(); ExprValidationException message = BaseNestableEventUtil.comparePropType(propName, setOneType, setTwoType, setTwoTypeFound, otherName); if (message != null) { return message; } } return null; }
private CodegenMethod getObjectArrayCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Object[].class, "array").getBlock() .declareVar(EventBean[].class, "wrapper", cast(EventBean[].class, arrayAtIndex(ref("array"), constant(propertyIndex)))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyValueCodegen(codegenMethodScope, codegenClassScope, index, nestedGetter), ref("wrapper"))); }
private CodegenMethod getFragmentCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Object[].class, "array").getBlock() .declareVar(EventBean[].class, "wrapper", cast(EventBean[].class, arrayAtIndex(ref("array"), constant(propertyIndex)))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyFragmentCodegen(codegenMethodScope, codegenClassScope, index, nestedGetter), ref("wrapper"))); }
private CodegenMethod getObjectArrayCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Object[].class, "oa").getBlock() .declareVar(Object.class, "inner", arrayAtIndex(ref("oa"), constant(propertyIndex))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyAsUnderlyingsArrayCodegen(underlyingType, codegenMethodScope, codegenClassScope), cast(EventBean[].class, ref("inner")))); }
public Object getObjectArray(Object[] array) throws PropertyAccessException { // If the map does not contain the key, this is allowed and represented as null EventBean[] wrapper = (EventBean[]) array[propertyIndex]; return BaseNestableEventUtil.getArrayPropertyValue(wrapper, index, nestedGetter); }
public boolean isDeepEqualsConsiderOrder(ObjectArrayEventType other) { EventTypeNestableGetterFactoryObjectArray factoryOther = (EventTypeNestableGetterFactoryObjectArray) other.getterFactory; EventTypeNestableGetterFactoryObjectArray factoryMe = (EventTypeNestableGetterFactoryObjectArray) getterFactory; if (factoryOther.getPropertiesIndex().size() != factoryMe.getPropertiesIndex().size()) { return false; } for (Map.Entry<String, Integer> propMeEntry : factoryMe.getPropertiesIndex().entrySet()) { Integer otherIndex = factoryOther.getPropertiesIndex().get(propMeEntry.getKey()); if (otherIndex == null || !otherIndex.equals(propMeEntry.getValue())) { return false; } String propName = propMeEntry.getKey(); Object setOneType = this.nestableTypes.get(propName); Object setTwoType = other.nestableTypes.get(propName); boolean setTwoTypeFound = other.nestableTypes.containsKey(propName); ExprValidationException comparedMessage = BaseNestableEventUtil.comparePropType(propName, setOneType, setTwoType, setTwoTypeFound, other.getName()); if (comparedMessage != null) { return false; } } return true; } }
private CodegenMethod getMapCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Map.class, "map").getBlock() .declareVar(EventBean[].class, "wrapper", cast(EventBean[].class, exprDotMethod(ref("map"), "get", constant(propertyName)))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyValueCodegen(codegenMethodScope, codegenClassScope, index, nestedGetter), ref("wrapper"))); }
private CodegenMethod getFragmentCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Map.class, "map").getBlock() .declareVar(EventBean[].class, "wrapper", cast(EventBean[].class, exprDotMethod(ref("map"), "get", constant(propertyName)))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyFragmentCodegen(codegenMethodScope, codegenClassScope, index, nestedGetter), ref("wrapper"))); }
private CodegenMethod getMapCodegen(CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { return codegenMethodScope.makeChild(Object.class, this.getClass(), codegenClassScope).addParam(Map.class, "map").getBlock() .declareVar(Object.class, "mapValue", exprDotMethod(ref("map"), "get", constant(propertyName))) .methodReturn(localMethod(BaseNestableEventUtil.getArrayPropertyAsUnderlyingsArrayCodegen(underlyingType, codegenMethodScope, codegenClassScope), cast(EventBean[].class, ref("mapValue")))); }
public Object getMap(Map<String, Object> map) throws PropertyAccessException { // If the map does not contain the key, this is allowed and represented as null EventBean[] wrapper = (EventBean[]) map.get(propertyName); return BaseNestableEventUtil.getArrayPropertyValue(wrapper, index, nestedGetter); }
public boolean isExistsProperty(EventBean eventBean) { Object[] array = BaseNestableEventUtil.checkedCastUnderlyingObjectArray(eventBean); return array.length > index; }
public Object getFragment(EventBean obj) { Map<String, Object> map = BaseNestableEventUtil.checkedCastUnderlyingMap(obj); return map.get(propertyName); }
Object setTwoType = oaResultType.getTypes().get(propertyName); boolean setTwoTypeFound = oaResultType.getTypes().containsKey(propertyName); ExprValidationException message = BaseNestableEventUtil.comparePropType(propertyName, setOneType, setTwoType, setTwoTypeFound, oaResultType.getName()); if (message != null) { throw new ExprValidationException(message.getMessage(), message);