Example usage for org.eclipse.jdt.core.dom TypeLiteral getType

List of usage examples for org.eclipse.jdt.core.dom TypeLiteral getType

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom TypeLiteral getType.

Prototype

public Type getType() 

Source Link

Document

Returns the type in this type literal expression.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(TypeLiteral node) {
    node.getType().accept(this);
    this.fBuffer.append(".class");//$NON-NLS-1$
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(TypeLiteral node) {
    boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder();
    //      b.setPosition(pos.build());
    b.setKind(boa.types.Ast.Expression.ExpressionKind.LITERAL);
    b.setLiteral(typeName(node.getType()) + ".class");
    expressions.push(b.build());/* ww  w . j a  v a 2s  .c o  m*/
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(TypeLiteral node) {
    node.getType().accept(this);
    this.buffer.append(".class");//$NON-NLS-1$
    return false;
}

From source file:com.google.dart.java2dart.SyntaxTranslator.java

License:Open Source License

@Override
public boolean visit(org.eclipse.jdt.core.dom.TypeLiteral node) {
    org.eclipse.jdt.core.dom.Type javaType = node.getType();
    Identifier result = null;//ww  w.  ja v a2 s  .c  o m
    if (javaType instanceof org.eclipse.jdt.core.dom.SimpleType) {
        result = ((TypeName) translate(javaType)).getName();
    }
    return done(result);
}

From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java

License:Open Source License

@Override
public boolean visit(TypeLiteral node) {
    Type type = node.getType();
    ITypeBinding typeBinding = Types.getTypeBinding(type);
    if (typeBinding != null && typeBinding.isInterface()) {
        buffer.append("[IOSClass classWithProtocol:@protocol(");
        type.accept(this);
        buffer.append(")]");
    } else {//from  w  w w  . java2  s  .c om
        buffer.append("[IOSClass classWithClass:[");
        type.accept(this);
        buffer.append(" class]]");
    }
    return false;
}

From source file:com.google.devtools.j2cpp.translate.Autoboxer.java

License:Open Source License

@Override
public void endVisit(TypeLiteral node) {
    ITypeBinding binding = Types.getTypeBinding(node.getType());
    if (binding.isPrimitive() && !Types.isVoidType(binding)) {
        Type boxedType = Types.makeType(Types.getWrapperType(binding));
        node.setType(boxedType);/*from  w  w  w .j a v  a2 s.  c  o m*/
    }
}

From source file:com.google.devtools.j2cpp.types.ImplementationImportCollector.java

License:Open Source License

@Override
public boolean visit(TypeLiteral node) {
    addReference(node.getType());
    return super.visit(node);
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(TypeLiteral node) {
    node.getType().accept(this);
    sb.print(".class");
    return false;
}

From source file:com.google.gdt.eclipse.designer.parser.ParseFactory.java

License:Open Source License

private static JavaInfo createJavaInfo_forGWTCreate(final AstEditor editor, final MethodInvocation invocation,
        Expression[] arguments) throws Exception {
    TypeLiteral typeLiteral = (TypeLiteral) arguments[0];
    final Class<?> classLiteral = getClass(editor, typeLiteral.getType().resolveBinding());
    return ExecutionUtils.runObjectIgnore(new RunnableObjectEx<JavaInfo>() {
        public JavaInfo runObject() throws Exception {
            return JavaInfoUtils.createJavaInfo(editor, classLiteral, new OpaqueCreationSupport(invocation));
        }/*from   www.  j  a  v a  2 s. c o  m*/
    }, null);
}

From source file:com.google.gdt.eclipse.designer.uibinder.model.util.NameSupport.java

License:Open Source License

/**
 * @return <code>true</code> if has initializer <code>GWT.create(UiBinder+.class)</code>.
 *///ww  w . jav a2s.c  o  m
public static boolean isBinderCreate(FieldDeclaration fieldDeclaration) {
    List<VariableDeclarationFragment> fragments = DomGenerics.fragments(fieldDeclaration);
    for (VariableDeclaration fragment : fragments) {
        if (fragment.getInitializer() instanceof MethodInvocation) {
            MethodInvocation invocation = (MethodInvocation) fragment.getInitializer();
            if (invocation.getName().getIdentifier().equals("create") && AstNodeUtils
                    .isSuccessorOf(invocation.getExpression(), "com.google.gwt.core.client.GWT")) {
                List<Expression> arguments = DomGenerics.arguments(invocation);
                if (arguments.size() == 1 && arguments.get(0) instanceof TypeLiteral) {
                    TypeLiteral typeLiteral = (TypeLiteral) arguments.get(0);
                    if (AstNodeUtils.isSuccessorOf(typeLiteral.getType(),
                            "com.google.gwt.uibinder.client.UiBinder")) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}