protected void initElements() { if(null == elements){ List<AElement> list = new ArrayList<AElement>(); for(Method m : type.getDeclaredMethods()){ if(Modifier.isPublic(m.getModifiers()) && !Modifier.isStatic(m.getModifiers()) && m.getParameterTypes().length == 0){ list.add(new AElement(m)); } } elements = list.toArray(new AElement[list.size()]); } } }
public AElement tryGetElement(String name) { initElements(); for(AElement e : elements){ if(e.getName().equals(name)){ return e; } } return null; }
protected void tryResolveErrorMessageFromAnnotation(Annotation a) { ReflectAnnotation ra = ReflectAnnotation.of(a.annotationType()); AElement e = ra.tryGetElement("message"); if(null != e){ this.setErrorMessageOrKey((String)e.getValue(a)); } }