java.lang.Object
org.omnifaces.util.Facelets
Collection of utility methods for working with Facelets.
For a full list, check the method summary.
- Since:
- 2.0
- Author:
- Arjan Tijms
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetBoolean(FaceletContext context, TagAttribute tagAttribute) Returns the boolean value of the given tag attribute.static ObjectgetObject(FaceletContext context, TagAttribute tagAttribute) Returns the Object value of the given tag attributestatic <T> TgetObject(FaceletContext context, TagAttribute tagAttribute, Class<?> type) Returns the typed Object value of the given tag attributestatic StringgetString(FaceletContext context, TagAttribute tagAttribute) Returns the String value of the given tag attribute.static StringgetStringLiteral(TagAttribute tagAttribute, String name) Returns the String literal of the given tag attribute.static ValueExpressiongetValueExpression(FaceletContext context, TagAttribute tagAttribute, Class<?> type) Returns the value of the given tag attribute as a value expression, so it can be carried around and evaluated at a later moment in the lifecycle without needing the Facelet context.
-
Method Details
-
getString
Returns the String value of the given tag attribute.- Parameters:
context- The involved Facelet context.tagAttribute- The tag attribute to retrieve the value from.- Returns:
- The String value of the given tag attribute, or null if the tag attribute is null.
-
getStringLiteral
Returns the String literal of the given tag attribute.- Parameters:
tagAttribute- The tag attribute to retrieve the value from.name- The tag attribute name; this is only used in exception message.- Returns:
- The String literal of the given tag attribute, or null if the tag attribute is null.
- Throws:
IllegalArgumentException- When the attribute is not a literal.- Since:
- 2.6
-
getBoolean
Returns the boolean value of the given tag attribute.- Parameters:
context- The involved Facelet context.tagAttribute- The tag attribute to retrieve the value from.- Returns:
- The boolean value of the given tag attribute, or false if the tag attribute is null.
-
getObject
Returns the Object value of the given tag attribute- Parameters:
context- The involved Facelet context.tagAttribute- The tag attribute to retrieve the value from.- Returns:
- The Object value of the given tag attribute, or null if the tag attribute is null.
-
getObject
Returns the typed Object value of the given tag attribute- Type Parameters:
T- The expected return type.- Parameters:
context- The involved Facelet context.tagAttribute- The tag attribute to retrieve the value from.type- The expected type of the Object value.- Returns:
- The typed Object value of the given tag attribute, or null if the tag attribute is null.
- Throws:
ClassCastException- WhenTis of wrong type.
-
getValueExpression
public static ValueExpression getValueExpression(FaceletContext context, TagAttribute tagAttribute, Class<?> type) Returns the value of the given tag attribute as a value expression, so it can be carried around and evaluated at a later moment in the lifecycle without needing the Facelet context.- Parameters:
context- The involved Facelet context.tagAttribute- The tag attribute to extract the value expression from.type- The expected type of the value behind the value expression.- Returns:
- The value of the given tag attribute as a value expression, or null if the tag attribute is null.
-