/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public org.eclipse.uml2.uml.Class getSuperClass(String name, boolean ignoreCase, EClass eClass) { superClassLoop : for (org.eclipse.uml2.uml.Class superClass : getSuperClasses()) { if (eClass != null && !eClass.isInstance(superClass)) continue superClassLoop; if (name != null && !(ignoreCase ? name.equalsIgnoreCase(superClass.getName()) : name.equals(superClass.getName()))) continue superClassLoop; return superClass; } return null; }
private void setSuperClass(OJAnnotatedClass annotatedClass, Class clazz) { List<Classifier> generals = clazz.getGenerals(); if (generals.size() > 1) { throw new IllegalStateException( String.format("Multiple inheritance is not supported! Class %s has more than on genereralization.", clazz.getName())); } if (!generals.isEmpty()) { Classifier superClassifier = generals.get(0); OJAnnotatedClass superClass = findOJClass(superClassifier); annotatedClass.setSuperclass(superClass.getPathName()); } }
private void generateInterfaceForEntityAndService(Element element, Stereotype stereotype) throws IOException { // Stereotype Interface Class clazz = (Class) element; logger.log(Level.FINE, "Class: " + clazz.getName() + " - " + "Stereotype: " + stereotype.getName()); // Generate the interface for this class CompilationUnit compilationUnit = interfaceGenerator.generateInterface( clazz, sourceDirectoryPackageName); generateClassFile(clazz, compilationUnit); }
private void generateCheckedException(Element element, Stereotype stereotype) throws IOException { // Stereotype Interface Class clazz = (Class) element; logger.log(Level.FINE, "Class: " + clazz.getName() + " - " + "Stereotype: " + stereotype.getName()); // Generate the exception for this class CompilationUnit compilationUnit = exceptionGenerator .generateCheckedException(clazz, sourceDirectoryPackageName); generateClassFile(clazz, compilationUnit); }
private void generateUncheckedException(Element element, Stereotype stereotype) throws IOException { // Stereotype Interface Class clazz = (Class) element; logger.log(Level.FINE, "Class: " + clazz.getName() + " - " + "Stereotype: " + stereotype.getName()); // Generate the exception for this class CompilationUnit compilationUnit = exceptionGenerator .generateUncheckedException(clazz, sourceDirectoryPackageName); generateClassFile(clazz, compilationUnit); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); }
public static String asOclSignature(Operation oper) { StringBuilder sb = new StringBuilder(); if (oper.getClass_() != null) { sb.append(oper.getClass_().getName()); } else if (oper.getDatatype() != null) { sb.append(oper.getDatatype().getName());
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::CompanyException"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("CompanyException"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); }
public void setUpMocks() throws Exception { String fullQualifiedName = "de::crowdcode::kissmda::testapp::components::Company"; clazz = mock(Class.class); when(clazz.getQualifiedName()).thenReturn(fullQualifiedName); when(clazz.getName()).thenReturn("Company"); when(clazz.getAssociations()) .thenReturn(new UniqueEList<Association>()); when(clazz.getImplementedInterfaces()).thenReturn( new UniqueEList<Interface>()); when(clazz.getGeneralizations()).thenReturn( new UniqueEList<Generalization>()); when(clazz.getOwnedComments()).thenReturn(new UniqueEList<Comment>()); }
private void addGetUmlName(OJAnnotatedClass annotatedClass, Class clazz) { OJAnnotatedOperation getUmlName = new OJAnnotatedOperation("getUmlName"); UmlgGenerationUtil.addOverrideAnnotation(getUmlName); getUmlName.setReturnType(new OJPathName("String")); getUmlName.setVisibility(OJVisibilityKind.PUBLIC); getUmlName.getBody().addToStatements("return \"" + clazz.getName() + "\""); annotatedClass.addToOperations(getUmlName); }
String metaclassName = metaclass.getName(); Extension extension = (Extension) profile.createOwnedType(metaclassName + '_' + name, UMLPackage.Literals.EXTENSION);
MethodDeclaration md = ast.newMethodDeclaration(); md.setConstructor(true); md.setName(ast.newSimpleName(clazz.getName())); md.modifiers().add( ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
@Test public void testGenerateConstructorWithParams() { AST ast = AST.newAST(AST.JLS3); TypeDeclaration td = ast.newTypeDeclaration(); td.setName(ast.newSimpleName("CompanyException")); when(clazz.getName()).thenReturn("CompanyException"); exceptionGenerator.generateConstructorWithParams(clazz, ast, td, new String[] { "String", "Throwable" }, new String[] { "message", "cause" }); assertEquals( "class CompanyException {\n" + " public CompanyException( String message, Throwable cause){\n" + " super(message,cause);\n }\n" + "}\n", td.toString()); } }
@Test public void testGenerateConstructors() { AST ast = AST.newAST(AST.JLS3); TypeDeclaration td = ast.newTypeDeclaration(); td.setName(ast.newSimpleName("CompanyException")); when(clazz.getName()).thenReturn("CompanyException"); exceptionGenerator.generateConstructors(clazz, ast, td); assertEquals( "class CompanyException {\n public CompanyException(){\n }\n" + " public CompanyException( Throwable cause){\n" + " super(cause);\n }\n public CompanyException( String message){\n" + " super(message);\n }\n" + " public CompanyException( String message, Throwable cause){\n" + " super(message,cause);\n }\n" + "}\n", td.toString()); }
StringUtils.uncapitalize(UmlgClassOperations.className(clazz)), clazz.getQualifiedName(), clazz.getName(), "inverseOf::" + clazz.getName(), "inverseOf::" + clazz.getQualifiedName(), false, false, null, Collections.<Validation>emptyList(), true, false, false, false, true, false, false, true, false, -1, 0, 1, false, false, false/*ordered*/, false, true,