Package org.eclipse.uml2.uml

Examples of org.eclipse.uml2.uml.Class


  @Test
  public void testGenerateClassUncheckedExceptionWithInheritance() {
    EList<Generalization> generalizations = new UniqueEList<Generalization>();
    Generalization generalization = mock(Generalization.class);
    Class clazzGeneralization = mock(Class.class);
    generalizations.add(generalization);
    when(generalization.getGeneral()).thenReturn(clazzGeneralization);
    when(clazzGeneralization.getQualifiedName()).thenReturn(
        "de::test::SuperCompanyException");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
View Full Code Here


  @SuppressWarnings("unchecked")
  @Test
  public void testGenerateClassWithInheritance() {
    EList<Generalization> generalizations = new UniqueEList<Generalization>();
    Generalization generalization = mock(Generalization.class);
    Class clazzGeneralization = mock(Class.class);
    generalizations.add(generalization);
    when(generalization.getGeneral()).thenReturn(clazzGeneralization);
    when(clazzGeneralization.getQualifiedName()).thenReturn(
        "de::test::SuperCompany");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();
View Full Code Here

    Modifier modifier = ast
        .newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
    td.modifiers().add(modifier);
    td.setName(ast.newSimpleName("Company"));

    Class clazz = mock(Class.class, Answers.RETURNS_DEEP_STUBS.get());
    EList<Comment> comments = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    Iterator<Comment> commentIterator = mock(Iterator.class);
    Comment comment = mock(Comment.class, Answers.RETURNS_DEEP_STUBS.get());

    when(clazz.getOwnedComments()).thenReturn(comments);
    when(comments.iterator()).thenReturn(commentIterator);
    when(commentIterator.hasNext()).thenReturn(true, false);
    when(commentIterator.next()).thenReturn(comment);
    when(comment.getBody()).thenReturn(
        "Comment...\nTest\n@author: Lofi Dewanto");
View Full Code Here

import org.eclipse.uml2.uml.Stereotype;

public class NameIsUnique extends AbstractModelConstraint {
  @Override
  public IStatus validate(IValidationContext ctx) {
    Class uml_class = (Class) ctx.getTarget();
    Stereotype stereotype = uml_class.getAppliedStereotype("SysML::Blocks::Block");
   
    //
    // We only check SysML Blocks
    //
    if (stereotype == null) {
      return ctx.createSuccessStatus();
    }
   
    if (ctx.getCurrentConstraintData() == null)
    {
      ctx.putCurrentConstraintData(new HashMap<String, EObject>());
    }
   
    @SuppressWarnings("unchecked")
    HashMap<String, EObject> name_map = (HashMap<String, EObject>) ctx.getCurrentConstraintData();
   
    if (name_map.containsKey(uml_class.getName())) {
      return ctx.createFailureStatus("The name '" + uml_class.getName() + "' is not unique and already used");
    } else {
      name_map.put(uml_class.getName(), ctx.getTarget());
    }
   
    return ctx.createSuccessStatus();
  }
View Full Code Here

    packageHelper = new PackageHelper();
  }

  @Test
  public void testGetFullPackageNameWithClass() {
    Class clazz = mock(Class.class);
    when(clazz.getQualifiedName()).thenReturn(
        "Data::de::crowdcode::test::Company");
    String sourceDirectoryPackageName = "Data";

    String result = packageHelper.getFullPackageName(clazz,
        sourceDirectoryPackageName);
View Full Code Here

  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;
  }
View Full Code Here

  public EList<Operation> getAllOperations(Classifier classifier) {
    EList<Operation> operations = new UniqueEList<Operation>();

    operations.addAll(classifier.getOperations());
    if (classifier instanceof org.eclipse.uml2.uml.Class) {
      Class clazz = (Class) classifier;
      for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) {
        operations.addAll(getAllInterfaceOperations(clazz
            .getImplementedInterfaces().get(i)));
      }
    }
    return operations;
  }
View Full Code Here

  public EList<Dependency> getAllDependencies(NamedElement element) {
    EList<Dependency> dependencies = new UniqueEList<Dependency>();

    dependencies.addAll(element.getClientDependencies());
    if (element instanceof org.eclipse.uml2.uml.Class) {
      Class clazz = (Class) element;
      for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) {
        dependencies.addAll(getAllInterfaceAssociations(clazz
            .getImplementedInterfaces().get(i)));
      }
    }

    EList<Dependency> depsFiltered = new UniqueEList<Dependency>();
View Full Code Here

  public EList<Association> getAllAssociations(Classifier classifier) {
    EList<Association> associations = new UniqueEList<Association>();

    associations.addAll(classifier.getAssociations());
    if (classifier instanceof org.eclipse.uml2.uml.Class) {
      Class clazz = (Class) classifier;
      for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) {
        associations.addAll(getAllInterfaceAssociations(clazz
            .getImplementedInterfaces().get(i)));
      }
    }
    return associations;
  }
View Full Code Here

            logger.info("SourceDirectory package name: "
                + sourceDirectoryPackageName);
          }
          if (stereotype.getName().equals(STEREOTYPE_ENTITY)) {
            // Stereotype Interface
            Class clazz = (Class) element;
            logger.info("Class: " + clazz.getName() + " - "
                + "Stereotype: " + stereotype.getName());
            // Generate xxx for this class
            // ...
           
            generateClassFile(clazz, "TODO");
View Full Code Here

TOP

Related Classes of org.eclipse.uml2.uml.Class

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.