package foundation.handler;
|
|
import foundation.json.IJSONWriter;
|
import foundation.util.Util;
|
|
public class MethodMeta {
|
|
private String id;
|
private String name;
|
private String title;
|
private String methodName;
|
private String providerName;
|
private double transactionScore;
|
private String operatorCode;
|
private String param;
|
|
public MethodMeta() {
|
|
}
|
|
public MethodMeta(String providerName, String simpleProviderName, String methodName) {
|
this.id = providerName + "-" + methodName;
|
this.name = simpleProviderName + "-" + methodName;
|
this.providerName = providerName;
|
this.methodName = methodName;
|
|
this.title = "";
|
transactionScore = 0;
|
|
parseMethodName(methodName);
|
operatorCode = methodName;
|
}
|
|
private void parseMethodName(String value) {
|
if (Util.isEmpty(value)) {
|
methodName = value;
|
}
|
|
methodName = methodName.trim().replace("(", "(").replace(")", ")");
|
int pos = value.indexOf("(");
|
|
if (pos <= 0) {
|
methodName = value;
|
return;
|
}
|
|
methodName = value.substring(0, pos);
|
param = value.substring(pos + 1, value.length() - 1);
|
param = param.trim();
|
}
|
|
public String getId() {
|
return id;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public String getTitle() {
|
return title;
|
}
|
|
public String getMethodName() {
|
return methodName;
|
}
|
|
public String getProviderName() {
|
return providerName;
|
}
|
|
public double getTransactionScore() {
|
return transactionScore;
|
}
|
|
@Override
|
public String toString() {
|
return providerName + "." + methodName;
|
}
|
|
public void writeJSONBody(IJSONWriter writer) {
|
writer.write("id", id);
|
writer.write("name", name);
|
writer.write("title", title);
|
writer.write("method_name", methodName);
|
writer.write("provider_name", providerName);
|
writer.write("transactionScore", transactionScore);
|
}
|
}
|