64 lines
1.5 KiB
Java
64 lines
1.5 KiB
Java
package com.ubt.jimu.blockly.command;
|
|
|
|
import com.ubt.jimu.utils.JsonHelper;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class BlocklyCommand<T> {
|
|
private T arg;
|
|
private String callback;
|
|
private BlocklyCommand<T>.CommandArg extraArg;
|
|
private String name;
|
|
private String url;
|
|
|
|
public class CommandArg {
|
|
private String branchId;
|
|
|
|
public CommandArg() {
|
|
}
|
|
|
|
public String getBranchId() {
|
|
return this.branchId;
|
|
}
|
|
}
|
|
|
|
public BlocklyCommand(String str, Class<T> cls) {
|
|
parseCommand(str, cls);
|
|
}
|
|
|
|
private void parseCommand(String str, Class<T> cls) {
|
|
if (str.startsWith(BlocklyCommandController.BASE_REQUEST_URL)) {
|
|
String[] split = str.split("\\|");
|
|
this.name = split[0];
|
|
if (split.length > 1 && split[1].contains("\":") && cls != null) {
|
|
this.arg = (T) JsonHelper.a(split[1], (Class<?>) cls);
|
|
}
|
|
if (split.length > 2) {
|
|
this.callback = split[2];
|
|
}
|
|
if (split.length > 3) {
|
|
this.extraArg = (CommandArg) JsonHelper.a(split[3], (Class<?>) CommandArg.class);
|
|
}
|
|
}
|
|
}
|
|
|
|
public T getArg() {
|
|
return this.arg;
|
|
}
|
|
|
|
public String getCallback() {
|
|
return this.callback;
|
|
}
|
|
|
|
public BlocklyCommand<T>.CommandArg getExtraArg() {
|
|
return this.extraArg;
|
|
}
|
|
|
|
public String getName() {
|
|
return this.name;
|
|
}
|
|
|
|
public String getUrl() {
|
|
return this.url;
|
|
}
|
|
}
|