/** * Collects all attributes the classifier and their interfaces have. * * @param classifier * The classifier the attributes should be collected * @return An <code>EList</code> with all collected attributes */ public EList<Property> getAllAttributes(Classifier classifier) { EList<Property> attributes = new UniqueEList<Property>(); attributes.addAll(classifier.getAttributes()); if (classifier instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) classifier; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { attributes.addAll(getAllInterfaceAttributes(clazz .getImplementedInterfaces().get(i))); } } return attributes; }
/** * Collects all attributes of the given interface needed to implement * (creating fields and getter/setter methods) by a implementing class. * * @param iFace * The interface to collect the operations from * @return An <code>EList</code> with all collected attributes */ private EList<Property> getAllInterfaceAttributes(Interface iFace) { EList<Property> attributes = new UniqueEList<Property>(); attributes.addAll(iFace.getAllAttributes()); if (iFace.getGeneralizations().size() > 0) { for (int i = 0; i < iFace.getGeneralizations().size(); i++) { attributes.addAll(getAllInterfaceAttributes((Interface) iFace .getGeneralizations().get(i).getGeneral())); } } return attributes; }