Java Code Examples for org.jf.dexlib2.iface.Field#getName()

The following examples show how to use org.jf.dexlib2.iface.Field#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassReIClassDef.java    From atlas with Apache License 2.0 6 votes vote down vote up
@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()));
}
 
Example 2
Source File: MetaObjectDex.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
@Override
public FieldInfo[] getDeclaredFields() {
    List<FieldInfo> result = new ArrayList<>();
    Iterable<? extends Field> implFields = classDef.getFields();

    for (Field field : implFields) {
        FieldInfo fi = new FieldInfo();
        fi.typeName = DexlibAdapter.getTypeName(field.getType());
        fi.modifiers = field.getAccessFlags();
        fi.annotations = convertAnnotations(field.getAnnotations());
        fi.name = field.getName();

        result.add(fi);
    }

    FieldInfo[] array = new FieldInfo[result.size()];
    return result.toArray(array);
}
 
Example 3
Source File: ImmutableField.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example 4
Source File: ImmutableField.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example 5
Source File: DexField.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
/**
 *
 * @return the Soot equivalent of a field
 */
public static SootField makeSootField(Field f) {
    String name = f.getName();
    Type type = DexType.toSoot(f.getType());
    int flags = f.getAccessFlags();
    SootField sf = new SootField(name, type, flags);
    if (Modifier.isFinal(flags))
        DexField.addConstantTag(sf, f);
    return sf;
}
 
Example 6
Source File: ImmutableField.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example 7
Source File: ImmutableField.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
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());
}