Code example for Field

Methods: getAnnotation, getType, isAnnotationPresent

0
 
public class ValueType 
{ 
	public static ValueTemplate getTemplate(Field field)
	{ 
		if(field.getType().isArray() && field.isAnnotationPresent(ListSize.class))
		{ 
			ListSize size = field.getAnnotation(ListSize.class);
			return new ListTemplate(field.getType(), size.value());
		} 
 
		return getTemplate(field.getType());
	} 
 
	public static ValueTemplate getTemplate(Class type)
	{ 
		if(type.equals(Color.class))
		{ 
			return new ColorTemplate(); 
		} 
		else if(type.equals(Rect.class))