feat(script): add options support

This commit is contained in:
Skylot
2022-07-21 20:39:05 +01:00
parent d9af91bc4d
commit 278d7fa3f9
10 changed files with 237 additions and 28 deletions
@@ -22,4 +22,12 @@ public interface OptionDescription {
*/
@Nullable
String defaultValue();
enum OptionType {
STRING, NUMBER, BOOLEAN
}
default OptionType getType() {
return OptionType.STRING;
}
}
@@ -12,12 +12,18 @@ public class JadxOptionDescription implements OptionDescription {
private final String desc;
private final String defaultValue;
private final List<String> values;
private final OptionType type;
public JadxOptionDescription(String name, String desc, @Nullable String defaultValue, List<String> values) {
this(name, desc, defaultValue, values, OptionType.STRING);
}
public JadxOptionDescription(String name, String desc, @Nullable String defaultValue, List<String> values, OptionType type) {
this.name = name;
this.desc = desc;
this.defaultValue = defaultValue;
this.values = values;
this.type = type;
}
@Override
@@ -40,6 +46,11 @@ public class JadxOptionDescription implements OptionDescription {
return values;
}
@Override
public OptionType getType() {
return type;
}
@Override
public String toString() {
return "OptionDescription{" + desc + ", values=" + values + '}';