本文整理汇总了Java中com.sun.tools.apt.mirror.AptEnv类的典型用法代码示例。如果您正苦于以下问题:Java AptEnv类的具体用法?Java AptEnv怎么用?Java AptEnv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AptEnv类属于com.sun.tools.apt.mirror包,在下文中一共展示了AptEnv类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTypeDeclaration
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns the type declaration for a class symbol.
* Forces completion, and returns null on error.
*/
public TypeDeclaration getTypeDeclaration(ClassSymbol c) {
long flags = AptEnv.getFlags(c); // forces symbol completion
if (c.kind == Kinds.ERR) {
return null;
}
TypeDeclaration res = typeDecls.get(c);
if (res == null) {
if ((flags & Flags.ANNOTATION) != 0) {
res = new AnnotationTypeDeclarationImpl(env, c);
} else if ((flags & Flags.INTERFACE) != 0) {
res = new InterfaceDeclarationImpl(env, c);
} else if ((flags & Flags.ENUM) != 0) {
res = new EnumDeclarationImpl(env, c);
} else {
res = new ClassDeclarationImpl(env, c);
}
typeDecls.put(c, res);
}
return res;
}
示例2: getModifiers
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Collection<Modifier> getModifiers() {
if (modifiers == null) {
modifiers = EnumSet.noneOf(Modifier.class);
long flags = AptEnv.getFlags(sym);
if (0 != (flags & Flags.PUBLIC)) modifiers.add(PUBLIC);
if (0 != (flags & Flags.PROTECTED)) modifiers.add(PROTECTED);
if (0 != (flags & Flags.PRIVATE)) modifiers.add(PRIVATE);
if (0 != (flags & Flags.ABSTRACT)) modifiers.add(ABSTRACT);
if (0 != (flags & Flags.STATIC)) modifiers.add(STATIC);
if (0 != (flags & Flags.FINAL)) modifiers.add(FINAL);
if (0 != (flags & Flags.TRANSIENT)) modifiers.add(TRANSIENT);
if (0 != (flags & Flags.VOLATILE)) modifiers.add(VOLATILE);
if (0 != (flags & Flags.SYNCHRONIZED)) modifiers.add(SYNCHRONIZED);
if (0 != (flags & Flags.NATIVE)) modifiers.add(NATIVE);
if (0 != (flags & Flags.STRICTFP)) modifiers.add(STRICTFP);
}
return modifiers;
}
示例3: typeParamsToString
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns the formal type parameters of a type, member or constructor
* as an angle-bracketed string. Each parameter consists of the simple
* type variable name and any bounds (with no implicit "extends Object"
* clause added). Type names are qualified.
* Returns "" if there are no type parameters.
*/
protected static String typeParamsToString(AptEnv env, Symbol sym) {
if (sym.type.getTypeArguments().isEmpty()) {
return "";
}
StringBuilder s = new StringBuilder();
for (Type t : sym.type.getTypeArguments()) {
Type.TypeVar tv = (Type.TypeVar) t;
s.append(s.length() == 0 ? "<" : ", ")
.append(TypeParameterDeclarationImpl.toString(env, tv));
}
s.append(">");
return s.toString();
}
示例4: AnnotationProxyMaker
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private AnnotationProxyMaker(AptEnv env,
Attribute.Compound attrs,
Class<? extends Annotation> annoType) {
this.env = env;
this.attrs = attrs;
this.annoType = annoType;
}
示例5: toString
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns the type parameter's name along with any "extends" clause.
* See {@link #toString()} for details.
*/
static String toString(AptEnv env, Type.TypeVar tv) {
StringBuilder s = new StringBuilder();
s.append(tv);
boolean first = true;
for (Type bound : getExtendsBounds(env, tv)) {
s.append(first ? " extends " : " & ");
s.append(env.typeMaker.typeToString(bound));
first = false;
}
return s.toString();
}
示例6: getExtendsBounds
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns the bounds of a type variable, eliding java.lang.Object
* if it appears alone.
*/
private static Iterable<Type> getExtendsBounds(AptEnv env,
Type.TypeVar tv) {
return (tv.getUpperBound().tsym == env.symtab.objectType.tsym)
? com.sun.tools.javac.util.List.<Type>nil()
: env.jctypes.getBounds(tv);
}
示例7: toString
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns a type's name, with any type parameters (including those
* of outer classes). Type names are qualified.
*/
static String toString(AptEnv env, ClassSymbol c) {
StringBuilder sb = new StringBuilder();
if (c.isInner()) {
// c is an inner class, so include type params of outer.
ClassSymbol enclosing = c.owner.enclClass();
sb.append(toString(env, enclosing))
.append('.')
.append(c.name);
} else {
sb.append(c);
}
sb.append(typeParamsToString(env, c));
return sb.toString();
}
示例8: getType
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Returns the javac type corresponding to a kind of primitive type.
*/
private static Type getType(AptEnv env, Kind kind) {
switch (kind) {
case BOOLEAN: return env.symtab.booleanType;
case BYTE: return env.symtab.byteType;
case SHORT: return env.symtab.shortType;
case INT: return env.symtab.intType;
case LONG: return env.symtab.longType;
case CHAR: return env.symtab.charType;
case FLOAT: return env.symtab.floatType;
case DOUBLE: return env.symtab.doubleType;
default: throw new AssertionError();
}
}
示例9: TypeMaker
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private TypeMaker(Context context) {
context.put(typeMakerKey, this);
env = AptEnv.instance(context);
voidType = new VoidTypeImpl(env);
primTypes[BOOLEAN] = new PrimitiveTypeImpl(env, Kind.BOOLEAN);
primTypes[BYTE] = new PrimitiveTypeImpl(env, Kind.BYTE);
primTypes[SHORT] = new PrimitiveTypeImpl(env, Kind.SHORT);
primTypes[INT] = new PrimitiveTypeImpl(env, Kind.INT);
primTypes[LONG] = new PrimitiveTypeImpl(env, Kind.LONG);
primTypes[CHAR] = new PrimitiveTypeImpl(env, Kind.CHAR);
primTypes[FLOAT] = new PrimitiveTypeImpl(env, Kind.FLOAT);
primTypes[DOUBLE] = new PrimitiveTypeImpl(env, Kind.DOUBLE);
}
示例10: Apt
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/** Create a new apt list. */
protected Apt(Context context) {
this.context = context;
context.put(aptKey, this);
aptenv = AptEnv.instance(context);
}
示例11: TypesImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private TypesImpl(Context context) {
context.put(typesKey, this);
env = AptEnv.instance(context);
}
示例12: DeclarationsImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private DeclarationsImpl(Context context) {
context.put(declarationsKey, this);
env = AptEnv.instance(context);
}
示例13: MethodDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
MethodDeclarationImpl(AptEnv env, MethodSymbol sym) {
super(env, sym);
}
示例14: AnnotationValueImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
AnnotationValueImpl(AptEnv env, Attribute attr, AnnotationMirrorImpl annotation) {
this.env = env;
this.attr = attr;
this.annotation = annotation;
}
示例15: MemberDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
protected MemberDeclarationImpl(AptEnv env, Symbol sym) {
super(env, sym);
}