Code example for Constructor

Methods: getAnnotations, getDeclaringClass, getGenericParameterTypes, getParameterAnnotations

0
	/** 
	 * Construct a list of type (to generate an arrow type) for this function, 
	 * based on the constructor's signature. 
	 */ 
	private static Type[] generateTypes(Constructor<?> constructor) {
		java.lang.reflect.Type[] parameters = constructor
				.getGenericParameterTypes();
		Annotation[][] annotations = constructor.getParameterAnnotations();
		TypeKnowledgeBase kb = new TypeKnowledgeBase();
 
		Type[] types = new Type[parameters.length + 1];
 
		for (int index = 0; index < parameters.length; index++) {
			types[index] = convertType(annotations[index], parameters[index],
					kb);
		} 
		types[types.length - 1] = convertType(constructor.getAnnotations(),
				constructor.getDeclaringClass(), kb);
		return types; 
	} 
 
	private final Constructor<?> constructor;