|
@@ -8,6 +8,7 @@ import jvcl.model.JOperation; |
|
|
import jvcl.operation.exec.ExecBase; |
|
|
import jvcl.operation.exec.ExecBase; |
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
import java.util.StringTokenizer; |
|
|
|
|
|
|
|
|
import static com.fasterxml.jackson.databind.type.TypeBindings.emptyBindings; |
|
|
import static com.fasterxml.jackson.databind.type.TypeBindings.emptyBindings; |
|
|
import static org.apache.commons.lang3.StringUtils.capitalize; |
|
|
import static org.apache.commons.lang3.StringUtils.capitalize; |
|
@@ -37,11 +38,21 @@ public class JOperationFactory extends DeserializationProblemHandler { |
|
|
if (id.contains(".")) { |
|
|
if (id.contains(".")) { |
|
|
className = id; |
|
|
className = id; |
|
|
} else { |
|
|
} else { |
|
|
className = OPERATION_DEFAULT_PACKAGE + "." + capitalize(id) + OPERATION_CLASSNAME_SUFFIX; |
|
|
|
|
|
|
|
|
className = OPERATION_DEFAULT_PACKAGE |
|
|
|
|
|
+ "." |
|
|
|
|
|
+ (id.contains("-") ? replaceHyphens(id) : capitalize(id)) |
|
|
|
|
|
+ OPERATION_CLASSNAME_SUFFIX; |
|
|
} |
|
|
} |
|
|
return forName(className); |
|
|
return forName(className); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String replaceHyphens(String id) { |
|
|
|
|
|
final StringBuilder b = new StringBuilder(); |
|
|
|
|
|
final StringTokenizer st = new StringTokenizer(id, "-"); |
|
|
|
|
|
while (st.hasMoreTokens()) b.append(capitalize(st.nextToken())); |
|
|
|
|
|
return b.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static <OP extends JOperation> Class<? extends ExecBase<OP>> getOperationExecClass(Class<? extends JOperation> opClass) { |
|
|
public static <OP extends JOperation> Class<? extends ExecBase<OP>> getOperationExecClass(Class<? extends JOperation> opClass) { |
|
|
final String name = opClass.getSimpleName(); |
|
|
final String name = opClass.getSimpleName(); |
|
|
if (!name.endsWith(OPERATION_CLASSNAME_SUFFIX)) { |
|
|
if (!name.endsWith(OPERATION_CLASSNAME_SUFFIX)) { |
|
|