Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.AST.newSimpleName()


    // public class SampleComposite extends Composite {

    TypeDeclaration classType = ast.newTypeDeclaration();
    classType.setInterface(false);
    // classType.s
    classType.setName(ast.newSimpleName(fileName));
    unit.types().add(classType);
    // classType.setSuperclass(ast.newSimpleName("Composite"));
    return new CompilationUnitImpl(unit);
  }
View Full Code Here


  public static void addLiteralMemberValuePair(NormalAnnotation annotation, String name, String value) {
    AST ast = annotation.getAST();
   
    List list = (List) annotation.getStructuralProperty(NormalAnnotation.VALUES_PROPERTY);
    MemberValuePair newValuePair = ast.newMemberValuePair();
    newValuePair.setName(ast.newSimpleName(name));
    newValuePair.setValue(ASTTools.newStringLiteral(ast, value));
    list.add(newValuePair);
  }

  public static MarkerAnnotation addAnnotation(BodyDeclaration bodyDeclaration, String annotationName) {
View Full Code Here

  @Test
  public void testGenerateSerialVersionUID() {
    AST ast = AST.newAST(AST.JLS3);
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("Company"));

    exceptionGenerator.generateSerialVersionUID(clazz, ast, td);

    assertEquals(
        "class Company {\n  private static final long serialVersionUID=1L;\n}\n",
View Full Code Here

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

  @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[] {
View Full Code Here

    td.setName(ast.newSimpleName("Company"));

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));

    String umlQualifiedTypeName = "test.de.Company";
    String umlTypeName = "Company";

    when(property.isOrdered()).thenReturn(true);
View Full Code Here

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

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));
View Full Code Here

    td.setName(ast.newSimpleName("Company"));

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));

    String umlQualifiedTypeName = "test.de.Company";
    String umlTypeName = "Company";

    when(property.isOrdered()).thenReturn(false);
View Full Code Here

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

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));
View Full Code Here

    td.setName(ast.newSimpleName("Company"));

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));

    String umlQualifiedTypeName = "test.de.Company";
    String umlTypeName = "Company";

    when(property.isOrdered()).thenReturn(false);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.