public static boolean fuzzyCompare(TypeManager typeManager, Object a, Object b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { // implicitly, one or other is null, not both return false; } Object array = null; Object other = null; if (a.getClass().isArray()) { array = a; other = b; } else if (b.getClass().isArray()) { array = b; other = a; } if (array != null) { for (int i = 0; i < Array.getLength(array); i++) { if (fuzzyCompare(typeManager, Array.get(array, i), other)) { return true; } } } return typeManager.getType(a.getClass()).getLogicalType().valueEquals(a, b) || typeManager.getType(b.getClass()).getLogicalType().valueEquals(b, a); }
public static boolean fuzzyCompare(TypeManager typeManager, Object a, Object b) { if (a == null && b == null) { return true; } else if (a == null || b == null) { // implicitly, one or other is null, not both return false; } Object array = null; Object other = null; if (a.getClass().isArray()) { array = a; other = b; } else if (b.getClass().isArray()) { array = b; other = a; } if (array != null) { for (int i = 0; i < Array.getLength(array); i++) { if (fuzzyCompare(typeManager, Array.get(array, i), other)) { return true; } } } return typeManager.getType(a.getClass()).getLogicalType().valueEquals(a, b) || typeManager.getType(b.getClass()).getLogicalType().valueEquals(b, a); }
actions.add(createColumnAlterAction(fromTable, ontoField, fromField)); } else if (fromField.getDefaultValue() != null && !Common.fuzzyCompare(typeManager, fromField.getDefaultValue(), ontoField.getDefaultValue())) { actions.add(createColumnAlterAction(fromTable, ontoField, fromField)); } else if (!physicalTypesEqual(fromField.getType(), ontoField.getType())) {
actions.add(createColumnAlterAction(fromTable, ontoField, fromField)); } else if (fromField.getDefaultValue() != null && !Common.fuzzyCompare(typeManager, fromField.getDefaultValue(), ontoField.getDefaultValue())) { actions.add(createColumnAlterAction(fromTable, ontoField, fromField)); } else if (!physicalTypesEqual(fromField.getType(), ontoField.getType())) {