當前位置: 首頁>>代碼示例>>Java>>正文


Java TypeVisitor類代碼示例

本文整理匯總了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);
}
 
開發者ID:git03394538,項目名稱:lombok-ianchiu,代碼行數:5,代碼來源:Javac.java

示例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;
}
 
開發者ID:yongjhih,項目名稱:auto-parse,代碼行數:16,代碼來源:TypeSimplifier.java

示例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);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:12,代碼來源:NoTypeImpl.java

示例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;
}
 
開發者ID:revapi,項目名稱:revapi,代碼行數:14,代碼來源:Util.java

示例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;
    }
  };
}
 
開發者ID:lshain-android-source,項目名稱:external-android-mock,代碼行數:34,代碼來源:UsesMocksProcessorTest.java

示例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();
}
 
開發者ID:Abnaxos,項目名稱:contracts,代碼行數:13,代碼來源:ParameterMapAnnotationProcessor.java

示例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));
  }
}
 
開發者ID:facebook,項目名稱:buck,代碼行數:41,代碼來源:StandaloneTypeMirror.java

示例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();
        }
    };
}
 
開發者ID:gboissinot,項目名稱:jenkins-csvexporter,代碼行數:14,代碼來源:ExportBeanListRetrieverTest.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:CachingElements.java

示例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();
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:7,代碼來源:Type.java

示例11: accept

import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
    throw new IllegalStateException();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:5,代碼來源:ApNavigator.java

示例12: accept

import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
public <R, P> R accept(TypeVisitor<R, P> v, P p) {
    return null;
}
 
開發者ID:LightSun,項目名稱:data-mediator,代碼行數:5,代碼來源:MockTypeMirror.java

示例13: ParameterVisitor

import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
public ParameterVisitor( TypeVisitor<Boolean,Void> parameterTypeVisitor )
{
    this.parameterTypeVisitor = parameterTypeVisitor;
}
 
開發者ID:fbiville,項目名稱:neo4j-sproc-compiler,代碼行數:5,代碼來源:ParameterVisitor.java

示例14: visitor

import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
protected TypeVisitor<Boolean,Void> visitor()
{
    return new RecordFieldTypeVisitor( types, typeMirrorUtils );
}
 
開發者ID:fbiville,項目名稱:neo4j-sproc-compiler,代碼行數:6,代碼來源:RecordFieldTypeVisitorTest.java

示例15: visitor

import javax.lang.model.type.TypeVisitor; //導入依賴的package包/類
@Override
protected TypeVisitor<Boolean,Void> visitor()
{
    return new ParameterTypeVisitor( types, typeMirrorUtils );
}
 
開發者ID:fbiville,項目名稱:neo4j-sproc-compiler,代碼行數:6,代碼來源:ParameterTypeVisitorTest.java


注:本文中的javax.lang.model.type.TypeVisitor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。