本文整理汇总了Java中javax.lang.model.util.SimpleTypeVisitor8类的典型用法代码示例。如果您正苦于以下问题:Java SimpleTypeVisitor8类的具体用法?Java SimpleTypeVisitor8怎么用?Java SimpleTypeVisitor8使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleTypeVisitor8类属于javax.lang.model.util包,在下文中一共展示了SimpleTypeVisitor8类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidListType
import javax.lang.model.util.SimpleTypeVisitor8; //导入依赖的package包/类
/**
* 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 );
}
示例2: isValidMapType
import javax.lang.model.util.SimpleTypeVisitor8; //导入依赖的package包/类
/**
* 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 );
}
示例3: toDeclaredType
import javax.lang.model.util.SimpleTypeVisitor8; //导入依赖的package包/类
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);
}
示例4: toTypeVariable
import javax.lang.model.util.SimpleTypeVisitor8; //导入依赖的package包/类
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);
}
示例5: toExecutableType
import javax.lang.model.util.SimpleTypeVisitor8; //导入依赖的package包/类
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);
}