static public OJPathName MapObjectString() { if (mapType == null) { mapType = JavaPathNames.Map.getCopy(); mapType.addToElementTypes(JavaPathNames.Object); mapType.addToElementTypes(JavaPathNames.String); } return mapType; }
static public OJPathName HashMapObjectString() { if (hashMapType == null) { hashMapType = JavaPathNames.HashMap.getCopy(); hashMapType.addToElementTypes(JavaPathNames.Object); hashMapType.addToElementTypes(JavaPathNames.String); } return hashMapType; } }
static public OJPathName SetOfObject() { if (setType == null) { setType = JavaPathNames.Set.getCopy(); setType.addToElementTypes(JavaPathNames.Object); } return setType; }
static public OJPathName ArrayListOfObject() { if (arrayListType == null) { arrayListType = JavaPathNames.ArrayList.getCopy(); arrayListType.addToElementTypes(JavaPathNames.Object); } return arrayListType; }
static public OJPathName ListOfObject() { if (listType == null) { listType = JavaPathNames.List.getCopy(); listType.addToElementTypes(JavaPathNames.Object); } return listType; }
static public OJPathName HashSetOfObject() { if (hashSetType == null) { hashSetType = JavaPathNames.HashSet.getCopy(); hashSetType.addToElementTypes(JavaPathNames.Object); } return hashSetType; }
/** Copies all attributes and associations of this instance into 'copy'. True parts, i.e. associations marked 'aggregate' or 'composite', and attributes, are copied as well. References to other objects, i.e. associations not marked 'aggregate' or 'composite', will not be copied. The 'copy' will refer to the same objects as the original (this) instance. * * @param copy */ public void copyInfoInto(OJPathName copy) { super.copyInfoInto(copy); Iterator namesIt = new ArrayList<String>(getNames()).iterator(); while ( namesIt.hasNext() ) { String elem = (String) namesIt.next(); copy.addToNames(elem); } Iterator elementTypesIt = new ArrayList<OJPathName>(getElementTypes()).iterator(); while ( elementTypesIt.hasNext() ) { OJPathName elem = (OJPathName) elementTypesIt.next(); copy.addToElementTypes(elem); } }
public OJPathName getDeepCopy() { OJPathName result = new OJPathName(); result.setNames(new ArrayList(this.getNames())); List<OJPathName> elementTypes = getElementTypes(); for (OJPathName elementType : elementTypes) { OJPathName elementTypeCopy = elementType.getDeepCopy(); if (elementType.getLast().contains("extends")) { System.out.println(); } result.addToElementTypes(elementTypeCopy); } return result; }
private void generateQualifierGetter(OJAnnotatedClass ojClass, PropertyWrapper qualified) { OJAnnotatedOperation qualifierGetter = new OJAnnotatedOperation(qualified.getQualifiedGetterName()); qualifierGetter.addParam("context", qualified.getQualifierContextPathName()); ojClass.addToOperations(qualifierGetter); OJField result = new OJField(); result.setName("result"); result.setType(new OJPathName("java.util.List")); result.getType().addToElementTypes(UmlgGenerationUtil.UmlgQualifierPathName); result.setInitExp("new ArrayList<>()"); ojClass.addToImports("java.util.ArrayList"); qualifierGetter.setReturnType(result.getType()); qualifierGetter.getBody().addToLocals(result); buildUMLGQualifier(ojClass, qualified, qualifierGetter); List<Property> refinedQualifiers = qualified.getRefinedQualifieds(); for (Property refinedQualifier : refinedQualifiers) { buildUMLGQualifier(ojClass, new PropertyWrapper(refinedQualifier), qualifierGetter); } qualifierGetter.getBody().addToStatements("return result"); ojClass.addToImports(UmlgGenerationUtil.UmlgQualifierIdFactory); ojClass.addToImports(UmlgGenerationUtil.UmlgQualifierPathName); ojClass.addToImports(UmlgGenerationUtil.umlgMultiplicityPathName); }