refactor: split field init attribute

This commit is contained in:
Skylot
2020-11-16 20:54:57 +00:00
parent 42a44f210d
commit 98d8015015
14 changed files with 155 additions and 80 deletions
@@ -1,7 +1,9 @@
package jadx.api.plugins.input.data.annotations;
import java.util.Objects;
public class EncodedValue {
public static final EncodedValue NULL = new EncodedValue(EncodedType.ENCODED_NULL, new Object());
public static final EncodedValue NULL = new EncodedValue(EncodedType.ENCODED_NULL, null);
private final EncodedType type;
private final Object value;
@@ -19,9 +21,28 @@ public class EncodedValue {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EncodedValue that = (EncodedValue) o;
return type == that.getType() && Objects.equals(value, that.getValue());
}
@Override
public int hashCode() {
return Objects.hash(getType(), getValue());
}
@Override
public String toString() {
switch (type) {
case ENCODED_NULL:
return "null";
case ENCODED_STRING:
return (String) value;
case ENCODED_ARRAY: