Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.SimpleType


  public void testGetAstSimpleTypeJavaTypeCollection() {
    Map<String, String> javaTypes = createJavaTypes();
    when(dataTypeUtils.getJavaTypes()).thenReturn(javaTypes);

    String typeName = "Collection";
    SimpleType tp = jdtHelper.getAstSimpleType(ast, typeName);

    assertEquals("java.util.Collection", tp.getName().toString());
  }
View Full Code Here


  public void testGetAstSimpleTypeJavaTypeList() {
    Map<String, String> javaTypes = createJavaTypes();
    when(dataTypeUtils.getJavaTypes()).thenReturn(javaTypes);

    String typeName = "List";
    SimpleType tp = jdtHelper.getAstSimpleType(ast, typeName);

    assertEquals("java.util.List", tp.getName().toString());
  }
View Full Code Here

      String umlTypeName, String umlQualifiedTypeName,
      String sourceDirectoryPackageName, String collectionTypeConstant) {
    Type type = getChosenType(ast, umlTypeName, umlQualifiedTypeName,
        sourceDirectoryPackageName);
    // Create Collection
    SimpleType collectionType = ast.newSimpleType(ast
        .newName(collectionTypeConstant));
    ParameterizedType pt = ast.newParameterizedType(collectionType);
    pt.typeArguments().add(type);
    md.setReturnType2(pt);
    td.bodyDeclarations().add(md);
View Full Code Here

   *            input type name
   * @return JDT SimpleType
   */
  public SimpleType getAstSimpleType(AST ast, String typeName) {
    String javaType = dataTypeUtils.getJavaTypes().get(typeName);
    SimpleType tp = null;
    if (javaType != null) {
      tp = ast.newSimpleType(ast.newName(javaType));
    } else {
      tp = ast.newSimpleType(ast.newName(typeName));
    }
View Full Code Here

      String umlPropertyName, String sourceDirectoryPackageName,
      String collectionTypeConstant) {
    Type chosenType = getChosenType(ast, umlTypeName, umlQualifiedTypeName,
        sourceDirectoryPackageName);
    // Create Collection
    SimpleType collectionType = ast.newSimpleType(ast
        .newName(collectionTypeConstant));
    ParameterizedType pt = ast.newParameterizedType(collectionType);
    pt.typeArguments().add(chosenType);
    SingleVariableDeclaration variableDeclaration = ast
        .newSingleVariableDeclaration();
View Full Code Here

        // reconcile the superinterfaces
        List<Type> newSuperInterfaces = getNewSuperInterfaces(typeDeclaration
                .superInterfaceTypes(), newJavaFileVisitor);
        for (Type newSuperInterface : newSuperInterfaces) {
            if (newSuperInterface.isSimpleType()) {
                SimpleType st = (SimpleType) newSuperInterface;
                Name name = ast.newName(st.getName().getFullyQualifiedName());
                SimpleType newSt = ast.newSimpleType(name);
                typeDeclaration.superInterfaceTypes().add(newSt);
            } else {
                // this shouldn't happen - MyBatis Generator only generates simple names
                throw new ShellException("The Java file merger only supports simple types as super interfaces");
            }
        }

        // set the superclass
        if (newJavaFileVisitor.getSuperclass() != null) {
            if (newJavaFileVisitor.getSuperclass().isSimpleType()) {
                SimpleType st = (SimpleType) newJavaFileVisitor.getSuperclass();
                Name name = ast.newName(st.getName().getFullyQualifiedName());
                SimpleType newSt = ast.newSimpleType(name);
                typeDeclaration.setSuperclassType(newSt);
            } else {
                // this shouldn't happen - MyBatis Generator only generates simple names
                throw new ShellException("The Java file merger only supports simple types as super classes");
            }
View Full Code Here

        List<Type> answer = new ArrayList<Type>();

        for (Type newSuperInterface : newJavaFileVisitor.getSuperInterfaceTypes()) {
            if (newSuperInterface.isSimpleType()) {
                SimpleType newSimpleType = (SimpleType) newSuperInterface;
                String newName = newSimpleType.getName().getFullyQualifiedName();
               
                boolean found = false;
                for (Type existingSuperInterface : existingSuperInterfaces) {
                    if (existingSuperInterface.isSimpleType()) {
                        SimpleType existingSimpleType = (SimpleType) existingSuperInterface;

                        String existingName = existingSimpleType.getName().getFullyQualifiedName();

                        if (newName.equals(existingName)) {
                            found = true;
                            break;
                        }
View Full Code Here

    //
    // Is the class a direct subclass of TestCase?
    //
    Type superClass = td.getSuperclassType();
    if (superClass instanceof SimpleType) {
      SimpleType st = (SimpleType) superClass;
      if ("TestCase".equals(st.getName().getFullyQualifiedName())) {
        m_testCase = st;
      }
    }

    // Is the class a subclass of TestSuite?
View Full Code Here

    }

    //
    // Remove "extends TestCase"
    //
    SimpleType td = visitor.getTestCase();
    if (null != td) {
      result.remove(td, null);
    }

    //
View Full Code Here

    if (oldLiteral == null) {
      return rewrite;
    }

    SimpleName typeName = ast.newSimpleName(className);
    SimpleType type = ast.newSimpleType(typeName);
    TypeLiteral typeLiteral = ast.newTypeLiteral();
    typeLiteral.setType(type);
    final ITrackedNodePosition newValuePosition = rewrite.track(typeLiteral);

    rewrite.replace(oldLiteral, typeLiteral, null);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.SimpleType

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.