Hi I think there is no standard way to do that, because the component class hides the details of how the attributes are managed internally. If you need to know if an attribute has been set in facelets, you can create a custom TagHandlerDelegateFactory and implement and decorate ComponentHandlerDelegate (make it implement FacesWrapper too). Then, add a new MetaRule to detect these two attributes and add the info in an alternate property. That's the best I can imagine so far.
regards, Leonardo Uribe 2014-03-26 20:41 GMT+01:00 Thomas Andraschko <[email protected]>: > Hi, > > i currently try to develop a small addon to extract maxlength/required from > the BV annotations via a PostAddToViewEvent listener. > > e.g. > > @Max(5) @Min(1) private String test; > h:inputText value="#{bean.test}" > > should automatically set maxlength to 5 and required to true. > > Now, my problem is, how do i check if the attribute is really defined? > It's not enough to check "component.isRequired()" as the user could manually > set required=false in the facelets. > > I already tried via: > component.getAttributes > component.getValueExpression > or even > component.getStateHelper.get > > but it's always null. > > AFAICS the info is only available in the StateHelper impl in a fullStateMap > or similiar. > > Is there a spec conform way to check if the attribute is defined? > > Thanks! > > Regards, > Thomas
