本文整理汇总了Java中com.sun.tools.apt.mirror.AptEnv类的典型用法代码示例。如果您正苦于以下问题:Java AptEnv类的具体用法?Java AptEnv怎么用?Java AptEnv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AptEnv类属于com.sun.tools.apt.mirror包,在下文中一共展示了AptEnv类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:25,代码来源:DeclarationMaker.java
示例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;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:23,代码来源:DeclarationImpl.java
示例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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:21,代码来源:MemberDeclarationImpl.java
示例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;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:AnnotationProxyMaker.java
示例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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:16,代码来源:TypeParameterDeclarationImpl.java
示例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);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:11,代码来源:TypeParameterDeclarationImpl.java
示例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();
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:TypeDeclarationImpl.java
示例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();
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:17,代码来源:PrimitiveTypeImpl.java
示例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);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:15,代码来源:TypeMaker.java
示例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);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:Apt.java
示例11: TypesImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private TypesImpl(Context context) {
context.put(typesKey, this);
env = AptEnv.instance(context);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:TypesImpl.java
示例12: DeclarationsImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private DeclarationsImpl(Context context) {
context.put(declarationsKey, this);
env = AptEnv.instance(context);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:DeclarationsImpl.java
示例13: MethodDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
MethodDeclarationImpl(AptEnv env, MethodSymbol sym) {
super(env, sym);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:MethodDeclarationImpl.java
示例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;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:6,代码来源:AnnotationValueImpl.java
示例15: MemberDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
protected MemberDeclarationImpl(AptEnv env, Symbol sym) {
super(env, sym);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:MemberDeclarationImpl.java
示例16: DeclarationMaker
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
private DeclarationMaker(Context context) {
context.put(declarationMakerKey, this);
env = AptEnv.instance(context);
this.context = context;
this.javacompiler = JavaCompiler.instance(context);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:7,代码来源:DeclarationMaker.java
示例17: hasFlag
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
/**
* Does a symbol have a given flag?
*/
private static boolean hasFlag(Symbol s, long flag) {
return AptEnv.hasFlag(s, flag);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:7,代码来源:DeclarationMaker.java
示例18: AnnotationMirrorImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
AnnotationMirrorImpl(AptEnv env, Attribute.Compound anno, Declaration decl) {
this.env = env;
this.anno = anno;
this.decl = decl;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:6,代码来源:AnnotationMirrorImpl.java
示例19: InterfaceDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
InterfaceDeclarationImpl(AptEnv env, ClassSymbol sym) {
super(env, sym);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:InterfaceDeclarationImpl.java
示例20: ConstructorDeclarationImpl
import com.sun.tools.apt.mirror.AptEnv; //导入依赖的package包/类
ConstructorDeclarationImpl(AptEnv env, MethodSymbol sym) {
super(env, sym);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:ConstructorDeclarationImpl.java
注:本文中的com.sun.tools.apt.mirror.AptEnv类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论