private String sampleField;
public Class<?> setSampleField(Class<?> clazz,
- Class<? extends List> list, Class<? super Map> map,
+ Class<? extends List> list, Class<? super Map> map, Class<?> clazz2, Class<VWXZ> clazz3,
List<String> listString, Map<Integer,String> mapString,
Generic<Integer,String,Double,Short,Float> test,
String sampleField, int one, short two, double three, Object obj) {
public static void main(String[] args) {
- /*Method[] methods = SampleClass.class.getMethods();
+ Method[] methods = SampleClass.class.getMethods();
// Method[] methods = Class.class.getMethods();
Method method = null;
for(Method meth : methods) {
}
System.out.println();
Type returnType = method.getGenericReturnType();
- System.out.println(returnType);*/
+ System.out.println(returnType);
/*Type superCls = Generic.class.getGenericSuperclass();
//Type superCls = String.class.getGenericSuperclass();
}*/
- Method[] methods = Class.class.getMethods();
+ /*Method[] methods = Class.class.getMethods();
Method method = null;
for(Method mth : methods) {
if (mth.getName().equals("getConstructor")) {
}
System.out.println();
Type returnType = method.getGenericReturnType();
- System.out.println(returnType);
-
+ System.out.println(returnType);*/
+
+ /* TODO: Enumerate all methods in Class.class
+ Method[] methods = Class.class.getMethods();
+ for(Method mth : methods) {
+ System.out.println("===========================");
+ System.out.println("Method: " + mth.getName());
+ Type[] parameters = mth.getGenericParameterTypes();
+ for (int i = 0; i < parameters.length; i++) {
+ System.out.println(parameters[i]);
+ }
+ System.out.println();
+ Type returnType = mth.getGenericReturnType();
+ System.out.println(returnType + "\n");
+ }*/
/*Class[] parameterTypes = methods[0].getParameterTypes();
for(Class parameterType: parameterTypes){
return signature;
}
- // Check that the first and the second halves are the same, e.g., TT for Class<T>
- int halfPos = cleanSig.length()/2;
- String firstHalf = cleanSig.substring(0, halfPos);
- String secondHalf = cleanSig.substring(halfPos, cleanSig.length());
- if (firstHalf.equals(secondHalf)) {
- return firstHalf;
- } else {
- // This is probably a class, e.g., +java.lang.Class
+ // Check if this is not a class name, e.g., +java.lang.Class
+ if (cleanSig.contains(".")) {
return signature;
}
+
+ // Just return the second half of the signature to get the Type parameter
+ int halfPos = cleanSig.length()/2;
+ //String firstHalf = cleanSig.substring(0, halfPos);
+ String secondHalf = cleanSig.substring(halfPos, cleanSig.length());
+ return secondHalf;
}
// TODO: Fix for Groovy's model-checking
}