本文整理汇总了Java中com.android.dx.rop.annotation.Annotations.combine方法的典型用法代码示例。如果您正苦于以下问题:Java Annotations.combine方法的具体用法?Java Annotations.combine怎么用?Java Annotations.combine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.dx.rop.annotation.Annotations
的用法示例。
在下文中一共展示了Annotations.combine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotations0
import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
* Helper method for {@link #getAnnotations} which just gets the
* existing annotations, per se.
*
* @param attribs {@code non-null;} the attributes list to search in
* @return {@code non-null;} the set of annotations, which may be empty
*/
private static Annotations getAnnotations0(AttributeList attribs) {
AttRuntimeVisibleAnnotations visible =
(AttRuntimeVisibleAnnotations)
attribs.findFirst(AttRuntimeVisibleAnnotations.ATTRIBUTE_NAME);
AttRuntimeInvisibleAnnotations invisible =
(AttRuntimeInvisibleAnnotations)
attribs.findFirst(AttRuntimeInvisibleAnnotations.ATTRIBUTE_NAME);
if (visible == null) {
if (invisible == null) {
return Annotations.EMPTY;
}
return invisible.getAnnotations();
}
if (invisible == null) {
return visible.getAnnotations();
}
// Both are non-null, so combine them.
return Annotations.combine(visible.getAnnotations(),
invisible.getAnnotations());
}
示例2: getAnnotations
import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
* Gets the annotations out of a given {@link AttributeList}. This
* combines both visible and invisible annotations into a single
* result set and also adds in a system annotation for the
* {@code Signature} attribute if present.
*
* @param attribs {@code non-null;} the attributes list to search in
* @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getAnnotations(AttributeList attribs) {
Annotations result = getAnnotations0(attribs);
Annotation signature = getSignature(attribs);
if (signature != null) {
result = Annotations.combine(result, signature);
}
return result;
}
示例3: getClassAnnotations
import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
* Gets the annotations out of a given class, similar to {@link
* #getAnnotations}, also including annotations for translations
* of class-level attributes {@code EnclosingMethod} and
* {@code InnerClasses}, if present. Additionally, if the
* class is an annotation class, then this also includes a
* representation of all the {@code AnnotationDefault}
* values.
*
* @param cf {@code non-null;} the class in question
* @param args {@code non-null;} the high-level options
* @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getClassAnnotations(DirectClassFile cf,
CfOptions args) {
CstType thisClass = cf.getThisClass();
AttributeList attribs = cf.getAttributes();
Annotations result = getAnnotations(attribs);
Annotation enclosingMethod = translateEnclosingMethod(attribs);
try {
Annotations innerClassAnnotations =
translateInnerClasses(thisClass, attribs,
enclosingMethod == null);
if (innerClassAnnotations != null) {
result = Annotations.combine(result, innerClassAnnotations);
}
} catch (Warning warn) {
args.warn.println("warning: " + warn.getMessage());
}
if (enclosingMethod != null) {
result = Annotations.combine(result, enclosingMethod);
}
if (AccessFlags.isAnnotation(cf.getAccessFlags())) {
Annotation annotationDefault =
translateAnnotationDefaults(cf);
if (annotationDefault != null) {
result = Annotations.combine(result, annotationDefault);
}
}
return result;
}
示例4: getMethodAnnotations
import com.android.dx.rop.annotation.Annotations; //导入方法依赖的package包/类
/**
* Gets the annotations out of a given method, similar to {@link
* #getAnnotations}, also including an annotation for the translation
* of the method-specific attribute {@code Exceptions}.
*
* @param method {@code non-null;} the method in question
* @return {@code non-null;} the set of annotations, which may be empty
*/
public static Annotations getMethodAnnotations(Method method) {
Annotations result = getAnnotations(method.getAttributes());
TypeList exceptions = getExceptions(method);
if (exceptions.size() != 0) {
Annotation throwsAnnotation =
AnnotationUtils.makeThrows(exceptions);
result = Annotations.combine(result, throwsAnnotation);
}
return result;
}