/** * 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; }
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; } }
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);
Object setTwoType = mapResultType.getTypes().get(propertyName); boolean setTwoTypeFound = mapResultType.getTypes().containsKey(propertyName); ExprValidationException message = BaseNestableEventUtil.comparePropType(propertyName, setOneType, setTwoType, setTwoTypeFound, mapResultType.getName()); if (message != null) { throw new ExprValidationException(message.getMessage(), message);