Java 类javax.lang.model.util.SimpleTypeVisitor8 实例源码

项目:neo4j-sproc-compiler    文件:AllowedTypesValidator.java   
/**
 * Recursively visits List type arguments
 *
 * @param typeMirror the List type mirror
 * @return true if the declaration is valid, false otherwise
 */
private boolean isValidListType( TypeMirror typeMirror )
{
    return new SimpleTypeVisitor8<Boolean,Void>()
    {
        @Override
        public Boolean visitDeclared( DeclaredType list, Void aVoid )
        {
            List<? extends TypeMirror> typeArguments = list.getTypeArguments();
            if ( typeArguments.size() != 1 )
            {
                return false;
            }
            return test( typeArguments.get( 0 ) );
        }
    }.visit( typeMirror );
}
项目:neo4j-sproc-compiler    文件:AllowedTypesValidator.java   
/**
 * Recursively visits Map type arguments
 * Map key type argument must be a String as of Neo4j stored procedure specification
 * Map value type argument is recursively visited
 *
 * @param typeMirror Map type mirror
 * @return true if the declaration is valid, false otherwise
 */
private boolean isValidMapType( TypeMirror typeMirror )
{
    return new SimpleTypeVisitor8<Boolean,Void>()
    {
        @Override
        public Boolean visitDeclared( DeclaredType map, Void ignored )
        {
            List<? extends TypeMirror> typeArguments = map.getTypeArguments();
            if ( typeArguments.size() != 2 )
            {
                return false;
            }

            TypeMirror key = typeArguments.get( 0 );
            if ( !typeUtils.isSameType( key, typeMirrors.typeMirror( String.class ) ) )
            {
                return false;
            }
            return test( typeArguments.get( 1 ) );
        }
    }.visit( typeMirror );
}
项目:doma    文件:TypeMirrorUtil.java   
public static DeclaredType toDeclaredType(TypeMirror typeMirror,
        ProcessingEnvironment env) {
    assertNotNull(typeMirror, env);
    return typeMirror.accept(new SimpleTypeVisitor8<DeclaredType, Void>() {

        @Override
        public DeclaredType visitDeclared(DeclaredType t, Void p) {
            return t;
        }

    }, null);
}
项目:doma    文件:TypeMirrorUtil.java   
public static TypeVariable toTypeVariable(TypeMirror typeMirror,
        ProcessingEnvironment env) {
    assertNotNull(typeMirror, env);
    return typeMirror.accept(new SimpleTypeVisitor8<TypeVariable, Void>() {

        @Override
        public TypeVariable visitTypeVariable(TypeVariable t, Void p) {
            return t;
        }

    }, null);
}
项目:doma    文件:ElementUtil.java   
public static ExecutableType toExecutableType(ExecutableElement element,
        ProcessingEnvironment env) {
    assertNotNull(element, env);
    return element.asType().accept(
            new SimpleTypeVisitor8<ExecutableType, Void>() {

                @Override
                public ExecutableType visitExecutable(ExecutableType t,
                        Void p) {
                    return t;
                }
            }, null);
}