本文整理汇总了Java中org.jf.dexlib2.iface.Field.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java Field.getAnnotations方法的具体用法?Java Field.getAnnotations怎么用?Java Field.getAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jf.dexlib2.iface.Field
的用法示例。
在下文中一共展示了Field.getAnnotations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: of
import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
public static ImmutableField of(Field field) {
if (field instanceof ImmutableField) {
return (ImmutableField)field;
}
return new ImmutableField(
field.getDefiningClass(),
field.getName(),
field.getType(),
field.getAccessFlags(),
field.getInitialValue(),
field.getAnnotations());
}
示例2: writeTo
import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
public static void writeTo(IndentingWriter writer, Field field, boolean setInStaticConstructor) throws IOException {
EncodedValue initialValue = field.getInitialValue();
int accessFlags = field.getAccessFlags();
if (setInStaticConstructor &&
AccessFlags.STATIC.isSet(accessFlags) &&
AccessFlags.FINAL.isSet(accessFlags) &&
initialValue != null) {
if (!EncodedValueUtils.isDefaultValue(initialValue)) {
writer.write("# The value of this static final field might be set in the static constructor\n");
} else {
// don't write out the default initial value for static final fields that get set in the static
// constructor
initialValue = null;
}
}
writer.write(".field ");
writeAccessFlags(writer, field.getAccessFlags());
writer.write(field.getName());
writer.write(':');
writer.write(field.getType());
if (initialValue != null) {
writer.write(" = ");
EncodedValueAdaptor.writeTo(writer, initialValue);
}
writer.write('\n');
Collection<? extends Annotation> annotations = field.getAnnotations();
if (annotations.size() > 0) {
writer.indent(4);
AnnotationFormatter.writeTo(writer, annotations);
writer.deindent(4);
writer.write(".end field\n");
}
}
示例3: of
import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
public static ImmutableField of(Field field) {
if (field instanceof ImmutableField) {
return (ImmutableField) field;
}
return new ImmutableField(
field.getDefiningClass(),
field.getName(),
field.getType(),
field.getAccessFlags(),
field.getInitialValue(),
field.getAnnotations());
}
示例4: getFieldAnnotations
import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
@Nullable
@Override
public Set<? extends Annotation> getFieldAnnotations(@Nonnull Field field) {
Set<? extends Annotation> annotations = field.getAnnotations();
if (annotations.size() == 0) {
return null;
}
return annotations;
}