org.jf.dexlib2.iface.value.AnnotationEncodedValue Java Examples

The following examples show how to use org.jf.dexlib2.iface.value.AnnotationEncodedValue. 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: AnnotationEncodedValueAdaptor.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static void writeTo(IndentingWriter writer, AnnotationEncodedValue annotationEncodedValue)
                           throws IOException {
    writer.write(".subannotation ");
    writer.write(annotationEncodedValue.getType());
    writer.write('\n');

    writeElementsTo(writer, annotationEncodedValue.getElements());
    writer.write(".end subannotation");
}
 
Example #2
Source File: AnnotationEncodedValueAdaptor.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static void writeTo(IndentingWriter writer, AnnotationEncodedValue annotationEncodedValue)
                           throws IOException {
    writer.write(".subannotation ");
    writer.write(annotationEncodedValue.getType());
    writer.write('\n');

    writeElementsTo(writer, annotationEncodedValue.getElements());
    writer.write(".end subannotation");
}
 
Example #3
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #4
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof AnnotationEncodedValue) {
        AnnotationEncodedValue other = (AnnotationEncodedValue)o;
        return getType().equals(other.getType()) &&
                getElements().equals(other.getElements());
    }
    return false;
}
 
Example #5
Source File: ImmutableAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableAnnotationEncodedValue of(AnnotationEncodedValue annotationEncodedValue) {
    if (annotationEncodedValue instanceof ImmutableAnnotationEncodedValue) {
        return (ImmutableAnnotationEncodedValue)annotationEncodedValue;
    }
    return new ImmutableAnnotationEncodedValue(
            annotationEncodedValue.getType(),
            annotationEncodedValue.getElements());
}
 
Example #6
Source File: AnnotationEncodedValueAdaptor.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static void writeTo(IndentingWriter writer, AnnotationEncodedValue annotationEncodedValue)
                           throws IOException {
    writer.write(".subannotation ");
    writer.write(annotationEncodedValue.getType());
    writer.write('\n');

    writeElementsTo(writer, annotationEncodedValue.getElements());
    writer.write(".end subannotation");
}
 
Example #7
Source File: BaseAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #8
Source File: BaseAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof AnnotationEncodedValue) {
        AnnotationEncodedValue other = (AnnotationEncodedValue)o;
        return getType().equals(other.getType()) &&
                getElements().equals(other.getElements());
    }
    return false;
}
 
Example #9
Source File: ImmutableAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static ImmutableAnnotationEncodedValue of(AnnotationEncodedValue annotationEncodedValue) {
    if (annotationEncodedValue instanceof ImmutableAnnotationEncodedValue) {
        return (ImmutableAnnotationEncodedValue)annotationEncodedValue;
    }
    return new ImmutableAnnotationEncodedValue(
            annotationEncodedValue.getType(),
            annotationEncodedValue.getElements());
}
 
Example #10
Source File: ImmutableAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableAnnotationEncodedValue of(AnnotationEncodedValue annotationEncodedValue) {
    if (annotationEncodedValue instanceof ImmutableAnnotationEncodedValue) {
        return (ImmutableAnnotationEncodedValue)annotationEncodedValue;
    }
    return new ImmutableAnnotationEncodedValue(
            annotationEncodedValue.getType(),
            annotationEncodedValue.getElements());
}
 
Example #11
Source File: BaseAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #12
Source File: BaseAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof AnnotationEncodedValue) {
        AnnotationEncodedValue other = (AnnotationEncodedValue)o;
        return getType().equals(other.getType()) &&
                getElements().equals(other.getElements());
    }
    return false;
}
 
Example #13
Source File: ImmutableAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static ImmutableAnnotationEncodedValue of(AnnotationEncodedValue annotationEncodedValue) {
    if (annotationEncodedValue instanceof ImmutableAnnotationEncodedValue) {
        return (ImmutableAnnotationEncodedValue)annotationEncodedValue;
    }
    return new ImmutableAnnotationEncodedValue(
            annotationEncodedValue.getType(),
            annotationEncodedValue.getElements());
}
 
Example #14
Source File: AnnotationEncodedValueAdaptor.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static void writeTo(@Nonnull IndentingWriter writer,
                           @Nonnull AnnotationEncodedValue annotationEncodedValue,
                           @Nullable String containingClass) throws IOException {
    writer.write(".subannotation ");
    writer.write(annotationEncodedValue.getType());
    writer.write('\n');

    writeElementsTo(writer, annotationEncodedValue.getElements(), containingClass);
    writer.write(".end subannotation");
}
 
Example #15
Source File: AnnotationEncodedValueAdaptor.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static void writeTo(IndentingWriter writer, AnnotationEncodedValue annotationEncodedValue)
                           throws IOException {
    writer.write(".subannotation ");
    writer.write(annotationEncodedValue.getType());
    writer.write('\n');

    writeElementsTo(writer, annotationEncodedValue.getElements());
    writer.write(".end subannotation");
}
 
Example #16
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #17
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof AnnotationEncodedValue) {
        AnnotationEncodedValue other = (AnnotationEncodedValue)o;
        return getType().equals(other.getType()) &&
                getElements().equals(other.getElements());
    }
    return false;
}
 
Example #18
Source File: EncodedValueAdaptor.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static void writeTo(@Nonnull IndentingWriter writer, @Nonnull EncodedValue encodedValue,
                           @Nullable String containingClass)
        throws IOException {
    switch (encodedValue.getValueType()) {
        case ValueType.ANNOTATION:
            AnnotationEncodedValueAdaptor.writeTo(writer, (AnnotationEncodedValue) encodedValue, containingClass);
            return;
        case ValueType.ARRAY:
            ArrayEncodedValueAdaptor.writeTo(writer, (ArrayEncodedValue)encodedValue, containingClass);
            return;
        case ValueType.BOOLEAN:
            BooleanRenderer.writeTo(writer, ((BooleanEncodedValue) encodedValue).getValue());
            return;
        case ValueType.BYTE:
            ByteRenderer.writeTo(writer, ((ByteEncodedValue) encodedValue).getValue());
            return;
        case ValueType.CHAR:
            CharRenderer.writeTo(writer, ((CharEncodedValue) encodedValue).getValue());
            return;
        case ValueType.DOUBLE:
            DoubleRenderer.writeTo(writer, ((DoubleEncodedValue) encodedValue).getValue());
            return;
        case ValueType.ENUM:
            EnumEncodedValue enumEncodedValue = (EnumEncodedValue)encodedValue;
            boolean useImplicitReference = false;
            if (enumEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            writer.write(".enum ");
            ReferenceUtil.writeFieldDescriptor(writer, enumEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FIELD:
            FieldEncodedValue fieldEncodedValue = (FieldEncodedValue)encodedValue;
            useImplicitReference = false;
            if (fieldEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeFieldDescriptor(writer, fieldEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.FLOAT:
            FloatRenderer.writeTo(writer, ((FloatEncodedValue) encodedValue).getValue());
            return;
        case ValueType.INT:
            IntegerRenderer.writeTo(writer, ((IntEncodedValue) encodedValue).getValue());
            return;
        case ValueType.LONG:
            LongRenderer.writeTo(writer, ((LongEncodedValue) encodedValue).getValue());
            return;
        case ValueType.METHOD:
            MethodEncodedValue methodEncodedValue = (MethodEncodedValue)encodedValue;
            useImplicitReference = false;
            if (methodEncodedValue.getValue().getDefiningClass().equals(containingClass)) {
                useImplicitReference = true;
            }
            ReferenceUtil.writeMethodDescriptor(writer, methodEncodedValue.getValue(), useImplicitReference);
            return;
        case ValueType.NULL:
            writer.write("null");
            return;
        case ValueType.SHORT:
            ShortRenderer.writeTo(writer, ((ShortEncodedValue) encodedValue).getValue());
            return;
        case ValueType.STRING:
            ReferenceFormatter.writeStringReference(writer, ((StringEncodedValue) encodedValue).getValue());
            return;
        case ValueType.TYPE:
            writer.write(((TypeEncodedValue)encodedValue).getValue());
    }
}