public static boolean equals(Result result1, Result result2) { Assert.notNull(result1, "Result1 must be specified"); Assert.notNull(result2, "Result2 must be specified"); Assert.notNull(result1.getName(), "Result1 name must be specified"); Assert.notNull(result2.getName(), "Result2 name must be specified"); Assert.notNull(result1.getType(), "Result1 type must be specified"); Assert.notNull(result2.getType(), "Result2 type must be specified"); if (!result1.getName().equals(result2.getName())) return false; if (!result1.getType().equals(result2.getType())) return false; return true; }
public static boolean validate(Result result) { if (result == null) return false; Validator validator = Validator.getValidator(); validator.notEmpty(result.getType(), "\"Type\" must be specified"); boolean isValid = validator.isValid(); return isValid; }
public static Result clone(Result result) { if (result == null) return null; Result clone = create(); clone.setType(ObjectUtil.clone(result.getType())); clone.setName(ObjectUtil.clone(result.getName())); clone.setKey(ObjectUtil.clone(result.getKey())); clone.setConstruct(ObjectUtil.clone(result.getConstruct())); clone.setRequired(ObjectUtil.clone(result.getRequired())); return clone; }
public static boolean isEmpty(Result result) { if (result == null) return true; boolean status = false; status |= StringUtils.isEmpty(result.getType()); return status; }
public static String getLabel(Result result) { return result.getType(); }
public static Object getKey(Result result) { return result.getType(); }
public static Class<?> getResultType(Result result) { if (result != null && result.getType() != null) return TypeMap.INSTANCE.getTypeClassByTypeName(result.getType()); // TODO get this outta here return null; }