private void createConstructors(ClassNode cNode, List<String> knownImmutableClasses) { if (!validateConstructors(cNode)) return; List<PropertyNode> list = getInstanceProperties(cNode); boolean specialHashMapCase = list.size() == 1 && list.get(0).getField().getType().equals(HASHMAP_TYPE); if (specialHashMapCase) { createConstructorMapSpecial(cNode, list); } else { createConstructorMap(cNode, list, knownImmutableClasses); createConstructorOrdered(cNode, list); } }
private void createConstructor(ClassNode cNode) { // pretty toString will remember how the user declared the params and print accordingly final FieldNode constructorField = cNode.addField("$map$constructor", ACC_PRIVATE | ACC_SYNTHETIC, ClassHelper.boolean_TYPE, null); final FieldExpression constructorStyle = new FieldExpression(constructorField); if (cNode.getDeclaredConstructors().size() != 0) { // TODO: allow constructors which call provided constructor? throw new RuntimeException("Explicit constructors not allowed for " + MY_TYPE_NAME + " class: " + cNode.getNameWithoutPackage()); } List<PropertyNode> list = cNode.getProperties(); boolean specialHashMapCase = list.size() == 1 && list.get(0).getField().getType().equals(HASHMAP_TYPE); if (specialHashMapCase) { createConstructorMapSpecial(cNode, constructorStyle, list); } else { createConstructorMap(cNode, constructorStyle, list); createConstructorOrdered(cNode, constructorStyle, list); } }
private void createConstructor(ClassNode cNode) { // pretty toString will remember how the user declared the params and print accordingly final FieldNode constructorField = cNode.addField("$map$constructor", ACC_PRIVATE | ACC_SYNTHETIC, ClassHelper.boolean_TYPE, null); final FieldExpression constructorStyle = new FieldExpression(constructorField); if (cNode.getDeclaredConstructors().size() != 0) { // TODO: allow constructors which call provided constructor? throw new RuntimeException("Explicit constructors not allowed for " + MY_TYPE_NAME + " class: " + cNode.getNameWithoutPackage()); } List<PropertyNode> list = cNode.getProperties(); boolean specialHashMapCase = list.size() == 1 && list.get(0).getField().getType().equals(HASHMAP_TYPE); if (specialHashMapCase) { createConstructorMapSpecial(cNode, constructorStyle, list); } else { createConstructorMap(cNode, constructorStyle, list); createConstructorOrdered(cNode, constructorStyle, list); } }