private static Set<Method> createMethods(Element klass) { Set<arquitetura.touml.Method> methods = new HashSet<arquitetura.touml.Method>(); Set<arquitetura.representation.Method> methodsClass = new HashSet<arquitetura.representation.Method>(); if (klass instanceof Class) { methodsClass = ((Class) klass).getAllMethods(); } else { methodsClass = ((Interface) klass).getOperations(); } for (arquitetura.representation.Method method : methodsClass) { List<ParameterMethod> paramsMethod = method.getParameters(); List<Argument> currentMethodParams = new ArrayList<Argument>(); for (ParameterMethod param : paramsMethod) { currentMethodParams.add( Argument.create( param.getName(), Types.getByName(param.getType()), param.getDirection())); } if (method.isAbstract()) { arquitetura.touml.Method m = arquitetura.touml.Method.create() .withId(method.getId()) .withName(method.getName()) .abstractMethod() .withArguments(currentMethodParams) .withConcerns(method.getOwnConcerns()) // Inicio - Thaina 12/14 - Aspecto .withAspects(method.getAspects()) // Fim - Thaina 12/14 - Aspecto .withReturn(Types.getByName(method.getReturnType())) .build(); methods.add(m); } else { arquitetura.touml.Method m = arquitetura.touml.Method.create() .withId(method.getId()) .withName(method.getName()) .withArguments(currentMethodParams) .withConcerns(method.getOwnConcerns()) // Inicio - Thaina 12/14 - Aspecto .withAspects(method.getAspects()) // Fim - Thaina 12/14 - Aspecto .withReturn(Types.getByName(method.getReturnType())) .build(); methods.add(m); } } return methods; }
private static List<arquitetura.touml.Attribute> createAttributes(Operations op, Class klass) { List<arquitetura.touml.Attribute> attributes = new ArrayList<arquitetura.touml.Attribute>(); for (Attribute attribute : klass.getAllAttributes()) { arquitetura.touml.Attribute attr = arquitetura.touml.Attribute.create() .withName(attribute.getName()) .grafics(attribute.isGeneratVisualAttribute()) .withConcerns(attribute.getOwnConcerns()) .withVisibility(VisibilityKind.getByName(attribute.getVisibility())) .withType(Types.getByName(attribute.getType())); attributes.add(attr); } return attributes; }