当前位置: 首页>>代码示例>>Java>>正文


Java Field.getInitialValue方法代码示例

本文整理汇总了Java中org.jf.dexlib2.iface.Field.getInitialValue方法的典型用法代码示例。如果您正苦于以下问题:Java Field.getInitialValue方法的具体用法?Java Field.getInitialValue怎么用?Java Field.getInitialValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jf.dexlib2.iface.Field的用法示例。


在下文中一共展示了Field.getInitialValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reField

import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
@Override
protected Field reField(Field field) {
    String name = field.getName();
    String newType;
    boolean isBasic = false;
    boolean isArray = false;
    if (field.getType().startsWith("[")) {
        isArray = true;
    }
    if (basicType.containsKey(field.getType())) {
        newType = field.getType();
        isBasic = true;
    } else {

        newType = DefineUtils.getDalvikClassName(field.getType());
    }
    String defineClass = DefineUtils.getDalvikClassName(field.getDefiningClass());
    return new ImmutableField(
            reType,
            classProcessor.filedProcess(defineClass, isBasic ? basicType.get(newType) : newType + (isArray ? "[]" : ""), name).fieldName,
            isBasic ? newType :
                    DefineUtils.getDefineClassName(classProcessor.classProcess(isBasic ? basicType.get(newType) : newType).className, isArray),
            field.getAccessFlags(),
            field.getInitialValue(),
            getAnnotation(field.getAnnotations()));
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:27,代码来源:ClassReIClassDef.java

示例2: onSimpleEdit

import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
@Override
protected Field onSimpleEdit(Field patch, PatcherAnnotation annotation, Field target, boolean inPlace) {

	// Use the static field initializer value in source only
	// if not renaming, given that the static constructor in
	// source would only initialize it if not renamed.
	// This makes behavior predictable across compilers.
	EncodedValue value = inPlace ? target.getInitialValue() : null;
	value = filterInitialValue(patch, value);

	onSimpleRemove(patch, annotation, target);

	Field patched = new BasicField(
			patch.getDefiningClass(),
			patch.getName(),
			patch.getType(),
			patch.getAccessFlags(),
			value,
			annotation.getFilteredAnnotations());

	return super.onSimpleEdit(patched, annotation, target, inPlace);

}
 
开发者ID:DexPatcher,项目名称:dexpatcher-tool,代码行数:24,代码来源:FieldSetPatcher.java

示例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());
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:13,代码来源:ImmutableField.java

示例4: 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");
    }
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:38,代码来源:FieldDefinition.java

示例5: 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());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:13,代码来源:ImmutableField.java

示例6: apply

import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
@Override
public EncodedValue apply(Field input) {
    EncodedValue initialValue = input.getInitialValue();
    if (initialValue == null) {
        return ImmutableEncodedValueFactory.defaultValueForType(input.getType());
    }
    return initialValue;
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:9,代码来源:ClassPool.java

示例7: apply

import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
@Override
public boolean apply(Field input) {
    EncodedValue encodedValue = input.getInitialValue();
    return encodedValue != null && !EncodedValueUtils.isDefaultValue(encodedValue);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:6,代码来源:BuilderClassPool.java

示例8: intern

import org.jf.dexlib2.iface.Field; //导入方法依赖的package包/类
public void intern(@Nonnull ClassDef classDef) {
    PoolClassDef poolClassDef = new PoolClassDef(classDef);

    PoolClassDef prev = internedItems.put(poolClassDef.getType(), poolClassDef);
    if (prev != null) {
        throw new ExceptionWithContext("Class %s has already been interned", poolClassDef.getType());
    }

    typePool.intern(poolClassDef.getType());
    typePool.internNullable(poolClassDef.getSuperclass());
    typeListPool.intern(poolClassDef.getInterfaces());
    stringPool.internNullable(poolClassDef.getSourceFile());

    HashSet<String> fields = new HashSet<String>();
    for (Field field : poolClassDef.getFields()) {
        String fieldDescriptor = ReferenceUtil.getShortFieldDescriptor(field);
        if (!fields.add(fieldDescriptor)) {
            throw new ExceptionWithContext("Multiple definitions for field %s->%s",
                    poolClassDef.getType(), fieldDescriptor);
        }
        fieldPool.intern(field);

        EncodedValue initialValue = field.getInitialValue();
        if (initialValue != null) {
            DexPool.internEncodedValue(initialValue, stringPool, typePool, fieldPool, methodPool);
        }

        annotationSetPool.intern(field.getAnnotations());
    }

    HashSet<String> methods = new HashSet<String>();
    for (PoolMethod method : poolClassDef.getMethods()) {
        String methodDescriptor = ReferenceUtil.getShortMethodDescriptor(method);
        if (!methods.add(methodDescriptor)) {
            throw new ExceptionWithContext("Multiple definitions for method %s->%s",
                    poolClassDef.getType(), methodDescriptor);
        }
        methodPool.intern(method);
        internCode(method);
        internDebug(method);
        annotationSetPool.intern(method.getAnnotations());

        for (MethodParameter parameter : method.getParameters()) {
            annotationSetPool.intern(parameter.getAnnotations());
        }
    }

    annotationSetPool.intern(poolClassDef.getAnnotations());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:50,代码来源:ClassPool.java


注:本文中的org.jf.dexlib2.iface.Field.getInitialValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。