private static String buildOperationArgumentType(ModelNode p) { StringBuilder builder = new StringBuilder(); ModelType mt = getAdaptedArgumentType(p); boolean isList = mt == ModelType.LIST; builder.append(mt); boolean isObject = false; if (isList) { String t = null; if (p.hasDefined(Util.VALUE_TYPE)) { ModelNode vt = p.get(Util.VALUE_TYPE); isObject = isObject(vt); } if (isObject) { t = "OBJECT"; } else { t = p.get(Util.VALUE_TYPE).asType().name(); } builder.append(" of ").append(t); } return builder.toString(); }
private static String buildOperationArgumentType(ModelNode p) { StringBuilder builder = new StringBuilder(); ModelType mt = getAdaptedArgumentType(p); boolean isList = mt == ModelType.LIST; builder.append(mt); boolean isObject = false; if (isList) { String t = null; if (p.hasDefined(Util.VALUE_TYPE)) { ModelNode vt = p.get(Util.VALUE_TYPE); isObject = isObject(vt); } if (isObject) { t = "OBJECT"; } else { t = p.get(Util.VALUE_TYPE).asType().name(); } builder.append(" of ").append(t); } return builder.toString(); }
public static double compareAttributes(Property attr1, Property attr2) { double res = 1d; res *= compareStrings(attr1.getName(), attr2.getName()); ModelNode node1 = attr1.getValue(); ModelNode node2 = attr2.getValue(); boolean expressions1 = node1.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); boolean expressions2 = node2.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); boolean nullable1 = node1.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean nullable2 = node2.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); res *= compareStrings(node1.getType().name(), node2.getType().name()); res *= compareStrings(node1.get(ModelDescriptionConstants.DESCRIPTION).asString(), node2.get(ModelDescriptionConstants.DESCRIPTION).asString()); res *= expressions1 == expressions2 ? 1d : 0.9d; res *= nullable1 == nullable2 ? 1d : 0.9d; return res; }
public static double compareAttributes(Property attr1, Property attr2) { double res = 1d; res *= compareStrings(attr1.getName(), attr2.getName()); ModelNode node1 = attr1.getValue(); ModelNode node2 = attr2.getValue(); boolean expressions1 = node1.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); boolean expressions2 = node2.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false); boolean nullable1 = node1.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); boolean nullable2 = node2.get(ModelDescriptionConstants.NILLABLE).asBoolean(true); res *= compareStrings(node1.getType().name(), node2.getType().name()); res *= compareStrings(node1.get(ModelDescriptionConstants.DESCRIPTION).asString(), node2.get(ModelDescriptionConstants.DESCRIPTION).asString()); res *= expressions1 == expressions2 ? 1d : 0.9d; res *= nullable1 == nullable2 ? 1d : 0.9d; return res; }
public static double compareAttributes(AttributeDefinition attr1, AttributeDefinition attr2) { double res = 1d; res *= compareStrings(attr1.getName(), attr2.getName()); res *= compareStrings(attr1.getType().name(), attr2.getType().name()); res *= compareStrings(String.valueOf(attr1.isAllowExpression()), String.valueOf(attr2.isAllowExpression())); res *= compareStrings(String.valueOf(attr1.isAllowNull()), String.valueOf(attr2.isAllowNull())); res *= attr1.isAllowExpression() == attr2.isAllowExpression() ? 1d : 0.9d; res *= attr1.isAllowNull() == attr2.isAllowNull() ? 1d : 0.9d; return res; }
public static double compareAttributes(AttributeDefinition attr1, AttributeDefinition attr2) { double res = 1d; res *= compareStrings(attr1.getName(), attr2.getName()); res *= compareStrings(attr1.getType().name(), attr2.getType().name()); res *= compareStrings(String.valueOf(attr1.isAllowExpression()), String.valueOf(attr2.isAllowExpression())); res *= compareStrings(String.valueOf(attr1.isAllowNull()), String.valueOf(attr2.isAllowNull())); res *= attr1.isAllowExpression() == attr2.isAllowExpression() ? 1d : 0.9d; res *= attr1.isAllowNull() == attr2.isAllowNull() ? 1d : 0.9d; return res; }
if (ModelType.STRING.name().equals(type)) { def.setPropertyTypeClassName(String.class.getName()); else if (ModelType.INT.name().equals(type)) { def.setPropertyTypeClassName(Integer.class.getName()); else if (ModelType.LONG.name().equals(type)) { def.setPropertyTypeClassName(Long.class.getName()); else if (ModelType.BOOLEAN.name().equals(type)) { def.setPropertyTypeClassName(Boolean.class.getName()); else if (ModelType.BIG_INTEGER.name().equals(type)) { def.setPropertyTypeClassName(BigInteger.class.getName()); else if (ModelType.BIG_DECIMAL.name().equals(type)) { def.setPropertyTypeClassName(BigDecimal.class.getName()); if (ModelType.STRING.name().equals(type)) { def.setDefaultValue(node.get("default").asString()); else if (ModelType.INT.name().equals(type)) { def.setDefaultValue(node.get("default").asInt()); else if (ModelType.LONG.name().equals(type)) { def.setDefaultValue(node.get("default").asLong()); else if (ModelType.BOOLEAN.name().equals(type)) { def.setDefaultValue(node.get("default").asBoolean());
if (ModelType.STRING.name().equals(type)) { def.setPropertyTypeClassName(String.class.getName()); else if (ModelType.INT.name().equals(type)) { def.setPropertyTypeClassName(Integer.class.getName()); else if (ModelType.LONG.name().equals(type)) { def.setPropertyTypeClassName(Long.class.getName()); else if (ModelType.BOOLEAN.name().equals(type)) { def.setPropertyTypeClassName(Boolean.class.getName()); else if (ModelType.BIG_INTEGER.name().equals(type)) { def.setPropertyTypeClassName(BigInteger.class.getName()); else if (ModelType.BIG_DECIMAL.name().equals(type)) { def.setPropertyTypeClassName(BigDecimal.class.getName()); if (ModelType.STRING.name().equals(type)) { def.setDefaultValue(node.get("default").asString()); else if (ModelType.INT.name().equals(type)) { def.setDefaultValue(node.get("default").asInt()); else if (ModelType.LONG.name().equals(type)) { def.setDefaultValue(node.get("default").asLong()); else if (ModelType.BOOLEAN.name().equals(type)) { def.setDefaultValue(node.get("default").asBoolean());