Java源码示例:org.jf.dexlib2.iface.value.TypeEncodedValue
示例1
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof TypeEncodedValue) {
return getValue().equals(((TypeEncodedValue)o).getValue());
}
return false;
}
示例2
public static void getMethodAnnotaionPrepareClasses(DexDiffInfo dexDiffInfo, Set<String> prepareclasses){
for (DexBackedMethod method:dexDiffInfo.getModifiedMethods()){
Set<? extends Annotation>annotations = method.getAnnotations();
if (annotations == null){
continue;
}
for (Annotation annotation:annotations){
String type = annotation.getType();
if (type!= null&&type.startsWith("L")&&type.endsWith(";")){
prepareclasses.add(type.substring(1, type.length() - 1).replace('/', '.'));
System.out.println("prepare class: " + type);
}
Set<? extends AnnotationElement> elements = annotation.getElements();
for (AnnotationElement dexBackedAnnotationElement:elements){
if (dexBackedAnnotationElement.getValue() instanceof DexBackedArrayEncodedValue){
List<? extends EncodedValue> values = ((DexBackedArrayEncodedValue) dexBackedAnnotationElement.getValue()).getValue();
for (EncodedValue encodedValue:values) {
if (encodedValue instanceof TypeEncodedValue) {
prepareclasses.add(((TypeEncodedValue) encodedValue).getValue().substring(1, ((TypeEncodedValue) encodedValue).getValue().length() - 1).replace('/', '.'));
System.out.println("prepare class: " + ((TypeEncodedValue) encodedValue).getValue());
}
}
}else if (dexBackedAnnotationElement.getValue() instanceof DexBackedTypeEncodedValue){
String value = ((DexBackedTypeEncodedValue) dexBackedAnnotationElement.getValue()).getValue();
prepareclasses.add(value.substring(1, value.length() - 1).replace('/', '.'));
System.out.println("prepare class: " + value);
}
}
}
}
}
示例3
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof TypeEncodedValue) {
return getValue().equals(((TypeEncodedValue)o).getValue());
}
return false;
}
示例4
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof TypeEncodedValue) {
return getValue().equals(((TypeEncodedValue)o).getValue());
}
return false;
}
示例5
@Override
public boolean equals(@Nullable Object o) {
if (o instanceof TypeEncodedValue) {
return getValue().equals(((TypeEncodedValue)o).getValue());
}
return false;
}
示例6
public static ImmutableTypeEncodedValue of(@Nonnull TypeEncodedValue typeEncodedValue) {
if (typeEncodedValue instanceof ImmutableTypeEncodedValue) {
return (ImmutableTypeEncodedValue)typeEncodedValue;
}
return new ImmutableTypeEncodedValue(typeEncodedValue.getValue());
}
示例7
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((TypeEncodedValue)o).getValue());
}
示例8
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());
}
}
示例9
public static ImmutableTypeEncodedValue of(@Nonnull TypeEncodedValue typeEncodedValue) {
if (typeEncodedValue instanceof ImmutableTypeEncodedValue) {
return (ImmutableTypeEncodedValue)typeEncodedValue;
}
return new ImmutableTypeEncodedValue(typeEncodedValue.getValue());
}
示例10
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((TypeEncodedValue)o).getValue());
}
示例11
public static ImmutableTypeEncodedValue of(@Nonnull TypeEncodedValue typeEncodedValue) {
if (typeEncodedValue instanceof ImmutableTypeEncodedValue) {
return (ImmutableTypeEncodedValue)typeEncodedValue;
}
return new ImmutableTypeEncodedValue(typeEncodedValue.getValue());
}
示例12
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((TypeEncodedValue)o).getValue());
}
示例13
public static ImmutableTypeEncodedValue of(@Nonnull TypeEncodedValue typeEncodedValue) {
if (typeEncodedValue instanceof ImmutableTypeEncodedValue) {
return (ImmutableTypeEncodedValue)typeEncodedValue;
}
return new ImmutableTypeEncodedValue(typeEncodedValue.getValue());
}
示例14
@Override
public int compareTo(@Nonnull EncodedValue o) {
int res = Ints.compare(getValueType(), o.getValueType());
if (res != 0) return res;
return getValue().compareTo(((TypeEncodedValue)o).getValue());
}