|
|
@@ -0,0 +1,55 @@
|
|
|
+/*
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ * @copyright Ranides Atterwim
|
|
|
+ * @license WTFPL
|
|
|
+ * @url http://ranides.net/projects/assira
|
|
|
+ */
|
|
|
+
|
|
|
+package net.ranides.assira.reflection.impl;
|
|
|
+
|
|
|
+import java.lang.reflect.ParameterizedType;
|
|
|
+import java.lang.reflect.Type;
|
|
|
+import java.lang.reflect.TypeVariable;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import net.ranides.assira.collection.lists.ListUtils;
|
|
|
+import net.ranides.assira.reflection.IClass;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ */
|
|
|
+class RPClass extends RClass {
|
|
|
+
|
|
|
+ private final ParameterizedType ptype;
|
|
|
+ private final TypeVariable<?>[] keys;
|
|
|
+ private final Type[] vars;
|
|
|
+
|
|
|
+ public RPClass(Class<?> type, ParameterizedType ptype) {
|
|
|
+ super(type);
|
|
|
+ this.ptype = ptype;
|
|
|
+ this.keys = ((Class<?>)ptype.getRawType()).getTypeParameters();
|
|
|
+ this.vars = ptype.getActualTypeArguments();
|
|
|
+
|
|
|
+ System.out.printf("%n");
|
|
|
+ System.out.printf("RP.keys %s = %s%n", type, Arrays.toString(keys) );
|
|
|
+ System.out.printf("RP.vars %s = %s%n", type, Arrays.toString(vars));
|
|
|
+
|
|
|
+ if(null != ptype.getOwnerType()) {
|
|
|
+ System.out.printf("RP.outs %s = %s%n", type, ptype.getOwnerType());
|
|
|
+ IClass.typeinfo(ptype.getOwnerType());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IClass> params() {
|
|
|
+ return ListUtils.map(Arrays.asList(ptype.getActualTypeArguments()), IClass::typeinfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IClass outer() {
|
|
|
+ return IClass.typeinfo(ptype.getOwnerType());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|