private List<ParameterDescriptor> parameters(Class<?> introspected) throws IntrospectionException { List<ParameterDescriptor> parameters; Class<?> superIntrospected = introspected.getSuperclass(); if (superIntrospected == null) { parameters = new ArrayList<ParameterDescriptor>(); } else { parameters = parameters(superIntrospected); for (Field f : introspected.getDeclaredFields()) { Tuple tuple = get(f.getAnnotations()); ClassFieldBinding binding = new ClassFieldBinding(f); ParameterDescriptor parameter = create( binding, f.getGenericType(), tuple.argumentAnn, tuple.optionAnn, tuple.required, tuple.descriptionAnn, tuple.ann); if (parameter != null) { parameters.add(parameter); } } } return parameters; } }
private <T> MethodDescriptor<T> create(ClassDescriptor<T> classDescriptor, String name, Method method) throws IntrospectionException { Description info = new Description(method); MethodDescriptor<T> methodDescriptor = new MethodDescriptor<T>( classDescriptor, method, name, info); Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotationMatrix = method.getParameterAnnotations(); for (int i = 0;i < parameterAnnotationMatrix.length;i++) { Annotation[] parameterAnnotations = parameterAnnotationMatrix[i]; Type parameterType = parameterTypes[i]; Tuple tuple = get(parameterAnnotations); MethodArgumentBinding binding = new MethodArgumentBinding(i); ParameterDescriptor parameter = create( binding, parameterType, tuple.argumentAnn, tuple.optionAnn, tuple.required, tuple.descriptionAnn, tuple.ann); if (parameter != null) { methodDescriptor.addParameter(parameter); } else { log.log(Level.FINE, "Method argument with index " + i + " of method " + method + " is not annotated"); } } return methodDescriptor; }
private List<ParameterDescriptor> parameters(Class<?> introspected) throws IntrospectionException { List<ParameterDescriptor> parameters; Class<?> superIntrospected = introspected.getSuperclass(); if (superIntrospected == null) { parameters = new ArrayList<ParameterDescriptor>(); } else { parameters = parameters(superIntrospected); for (Field f : introspected.getDeclaredFields()) { Tuple tuple = get(f.getAnnotations()); ClassFieldBinding binding = new ClassFieldBinding(f); ParameterDescriptor parameter = create( binding, f.getGenericType(), tuple.argumentAnn, tuple.optionAnn, tuple.required, tuple.descriptionAnn, tuple.ann); if (parameter != null) { parameters.add(parameter); } } } return parameters; } }
private List<ParameterDescriptor> parameters(Class<?> introspected) throws IntrospectionException { List<ParameterDescriptor> parameters; Class<?> superIntrospected = introspected.getSuperclass(); if (superIntrospected == null) { parameters = new ArrayList<ParameterDescriptor>(); } else { parameters = parameters(superIntrospected); for (Field f : introspected.getDeclaredFields()) { Tuple tuple = get(f.getAnnotations()); ClassFieldBinding binding = new ClassFieldBinding(f); ParameterDescriptor parameter = create( binding, f.getGenericType(), tuple.argumentAnn, tuple.optionAnn, tuple.required, tuple.descriptionAnn, tuple.ann); if (parameter != null) { parameters.add(parameter); } } } return parameters; } }
Tuple tuple = get(parameterAnnotations);
private <T> MethodDescriptor<T> create(ClassDescriptor<T> classDescriptor, String name, Method method) throws IntrospectionException { Description info = new Description(method); MethodDescriptor<T> methodDescriptor = new MethodDescriptor<T>( classDescriptor, method, name, info); Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotationMatrix = method.getParameterAnnotations(); for (int i = 0;i < parameterAnnotationMatrix.length;i++) { Annotation[] parameterAnnotations = parameterAnnotationMatrix[i]; Type parameterType = parameterTypes[i]; Tuple tuple = get(parameterAnnotations); MethodArgumentBinding binding = new MethodArgumentBinding(i); ParameterDescriptor parameter = create( binding, parameterType, tuple.argumentAnn, tuple.optionAnn, tuple.required, tuple.descriptionAnn, tuple.ann); if (parameter != null) { methodDescriptor.addParameter(parameter); } else { log.log(Level.FINE, "Method argument with index " + i + " of method " + method + " is not annotated"); } } return methodDescriptor; }