I access the Attributes of my composite component this way:
enum PropertyKeys {comments, currentUserUsername}
@SuppressWarnings("unchecked")
private <T> T getAttribute(PropertyKeys propertyKey){
return (T) getStateHelper().eval(propertyKey);
}
private <T> void setAttribute(PropertyKeys propertyKey, T value){
getStateHelper().put(propertyKey, value);
}
private List<Comment> getComments() {
return getAttribute(PropertyKeys.comments);
}
private String getCurrentUserUsername() {
return getAttribute(PropertyKeys.currentUserUsername);
}
This works for the list (comment) but not for the String (CurrentUserUsername), when i pass the username this way:
<tr:commentBox comments="#{main.comments}" currentUserUsername="Hans" [...] />
But when i pass it this way:
<tr:commentBox comments="#{main.comments}" currentUserUsername="#{'Hans'}" [...] />
It works.
I dont want that anybody who will use my component have to put strings in as EL ...
Is there a solution so i can pass strings in as in the first snippet ?