本文整理匯總了Java中javax.lang.model.type.TypeVisitor類的典型用法代碼示例。如果您正苦於以下問題:Java TypeVisitor類的具體用法?Java TypeVisitor怎麽用?Java TypeVisitor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TypeVisitor類屬於javax.lang.model.type包,在下文中一共展示了TypeVisitor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
return v.visitNoType(this, p);
}
示例2: referencedClassTypes
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
/**
* Finds all declared types (classes and interfaces) that are referenced in the given
* {@code Set<TypeMirror>}. This includes classes and interfaces that appear directly in the set,
* but also ones that appear in type parameters and the like. For example, if the set contains
* {@code java.util.List<? extends java.lang.Number>} then both {@code java.util.List} and
* {@code java.lang.Number} will be in the resulting set.
*/
private static Set<TypeMirror> referencedClassTypes(Types typeUtil, Set<TypeMirror> types) {
Set<TypeMirror> referenced = new HashSet<TypeMirror>();
TypeVisitor<Void, Void> typeVisitor = new ReferencedClassTypeVisitor(typeUtil, referenced);
for (TypeMirror type : types) {
type.accept(typeVisitor, null);
}
return referenced;
}
示例3: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p)
{
switch(this.getKind())
{
case NULL :
return v.visitNull(this, p);
default:
return v.visitNoType(this, p);
}
}
示例4: visitIntersection
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public Void visitIntersection(IntersectionType t, StringBuilderAndState<TypeMirror> state) {
Iterator<? extends TypeMirror> it = IgnoreCompletionFailures.in(t::getBounds).iterator();
if (it.hasNext()) {
it.next().accept(this, state);
}
TypeVisitor<Void, StringBuilderAndState<TypeMirror>> me = this;
it.forEachRemaining(b -> { state.bld.append(", "); b.accept(me, state); });
return null;
}
示例5: getMockAnnotationType
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
private DeclaredType getMockAnnotationType() {
return new DeclaredType() {
@Override
public String toString() {
return UsesMocks.class.getName();
}
@Override
public Element asElement() {
return null;
}
@Override
public TypeMirror getEnclosingType() {
return null;
}
@Override
public List<? extends TypeMirror> getTypeArguments() {
return null;
}
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
return null;
}
@Override
public TypeKind getKind() {
return null;
}
};
}
示例6: getMethodDescriptor
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
private String getMethodDescriptor(ExecutableElement element) {
final StringBuilder buf = new StringBuilder();
buf.append(element.getSimpleName()).append('(');
TypeVisitor<Void, Void> typeWriter = new BinaryTypeWriter(buf);
for ( VariableElement param : element.getParameters() ) {
TypeMirror type = processingEnv.getTypeUtils().erasure(param.asType());
type.accept(typeWriter, null);
}
buf.append(')');
processingEnv.getTypeUtils().erasure(element.getReturnType()).accept(typeWriter, null);
return buf.toString();
}
示例7: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
switch (kind) {
case BOOLEAN:
case BYTE:
case SHORT:
case INT:
case LONG:
case CHAR:
case FLOAT:
case DOUBLE:
return v.visitPrimitive((PrimitiveType) this, p);
case PACKAGE:
case VOID:
case NONE:
return v.visitNoType((NoType) this, p);
case NULL:
return v.visitNull((NullType) this, p);
case ARRAY:
return v.visitArray((ArrayType) this, p);
case DECLARED:
return v.visitDeclared((DeclaredType) this, p);
case ERROR:
return v.visitError((ErrorType) this, p);
case TYPEVAR:
return v.visitTypeVariable((TypeVariable) this, p);
case WILDCARD:
return v.visitWildcard((WildcardType) this, p);
case EXECUTABLE:
return v.visitExecutable((ExecutableType) this, p);
case OTHER:
return v.visit(this, p);
case UNION:
return v.visitUnion((UnionType) this, p);
case INTERSECTION:
return v.visitIntersection((IntersectionType) this, p);
default:
throw new AssertionError(String.format("Unknown TypeKind: %s", kind));
}
}
示例8: noType
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
private static TypeMirror noType() {
return new NoType() {
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
throw new UnsupportedOperationException();
}
@Override
public TypeKind getKind() {
throw new UnsupportedOperationException();
}
};
}
示例9: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
return delegate.accept(v, p);
}
示例10: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
if (isPrimitive())
return v.visitPrimitive(this, p);
else
throw new AssertionError();
}
示例11: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
throw new IllegalStateException();
}
示例12: accept
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
return null;
}
示例13: ParameterVisitor
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
public ParameterVisitor( TypeVisitor<Boolean,Void> parameterTypeVisitor )
{
this.parameterTypeVisitor = parameterTypeVisitor;
}
示例14: visitor
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
protected TypeVisitor<Boolean,Void> visitor()
{
return new RecordFieldTypeVisitor( types, typeMirrorUtils );
}
示例15: visitor
import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
protected TypeVisitor<Boolean,Void> visitor()
{
return new ParameterTypeVisitor( types, typeMirrorUtils );
}