summaryrefslogtreecommitdiff
path: root/dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java
diff options
context:
space:
mode:
Diffstat (limited to 'dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java')
-rw-r--r--dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java52
1 files changed, 0 insertions, 52 deletions
diff --git a/dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java b/dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java
index d89fd10..e1a62fa 100644
--- a/dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java
+++ b/dicore3/command/src/main/java/io/dico/dicore/command/parameter/type/ParameterType.java
@@ -146,56 +146,4 @@ public abstract class ParameterType<TReturn, TParamInfo> {
}
- public @interface Reference {
-
- /**
- * The path to the static field holding the parameter type referred.
- *
- * @return The path
- */
- String value();
- }
-
- public static class ReferenceUtil {
-
- private ReferenceUtil() {
-
- }
-
-
- /**
- * Get the ParameterType with the associated Reference
- *
- * @param ref the reference
- * @return the parameter type object
- * @throws IllegalArgumentException if the class is found, but the field doesn't exist.
- * @throws IllegalStateException if this method fails to find the object for any other reason
- */
- public static Object getReference(Reference ref) {
- String[] path = ref.value().split("\\.");
- if (path.length < 2) {
- throw new IllegalStateException();
- }
-
- String fieldName = path[path.length - 1];
- String className = String.join(".", Arrays.copyOfRange(path, 0, path.length - 1));
-
- Class<?> clazz;
- try {
- clazz = Class.forName(className);
- } catch (ClassNotFoundException ex) {
- throw new IllegalArgumentException(ex);
- }
-
- Object result = Reflection.getStaticFieldValue(clazz, fieldName);
-
- if (result == null) {
- throw new IllegalStateException();
- }
-
- return result;
- }
-
- }
-
}