public ElementDeclaration configure(Property source, ElementDeclaration target) { target.setName(source.getName()); target.setMultiple(source.upperBound() != 1); target.setOptional(source.getLower() == 0); if (source.getType() instanceof Class) { ComplexType refType = createComplexType.apply((Class) source.getType()); target.setRef(refType); } else if (source.getType() instanceof org.eclipse.uml2.uml.PrimitiveType) { target.setType(getPrimitiveType(source.getType().getName())); } target.setDoc(JavaExtensions.getDocumentationText(source)); return target; }
public ComplexType configure(Class source, ComplexType target) { target.setName(source.getName()); if (!source.getSuperClasses().isEmpty()) { ComplexType baseType = apply(source.getSuperClasses().get(0)); target.setBaseType(baseType); } List<Property> properties = Lists.newArrayList( Iterables.concat( source.getOwnedAttributes(), getNavigableAssociationEnds(source))); Collections.sort(properties, Comparators.namedElementComparator); for (Property p : properties) { ElementDeclaration element = createElementDeclaration.apply(p); target.getElements().add(element); } target.setDoc(JavaExtensions.getDocumentationText(source)); addXmiId(source, getXmiId(source)); // target.getAnnotations().add(createTraceAnnotation.apply(source)); return target; }