Package com.sun.faces.facelets.tag
Class TagAttributeImpl
- java.lang.Object
-
- jakarta.faces.view.facelets.TagAttribute
-
- com.sun.faces.facelets.tag.TagAttributeImpl
-
public class TagAttributeImpl extends TagAttribute
Representation of a Tag's attribute in a Facelet File- Version:
- $Id$
- Author:
- Jacob Hookom
-
-
Constructor Summary
Constructors Constructor Description TagAttributeImpl()
TagAttributeImpl(Location location, String ns, String localName, String qName, String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getBoolean(FaceletContext ctx)
If literal,returnBoolean.valueOf(java.lang.String)
passing our value, otherwise callgetObject(FaceletContext, Class)
.int
getInt(FaceletContext ctx)
If literal, callInteger.parseInt(String)
, otherwise callgetObject(FaceletContext, Class)
.String
getLocalName()
Local name of this attributeLocation
getLocation()
The location of this attribute in the FaceletContextjakarta.el.MethodExpression
getMethodExpression(FaceletContext ctx, Class type, Class[] paramTypes)
Create a MethodExpression, using this attribute's value as the expression String.String
getNamespace()
The resolved Namespace for this attributeObject
getObject(FaceletContext ctx)
Delegates to getObject with Object.class as a paramObject
getObject(FaceletContext ctx, Class type)
If literal, simply coerce our String literal value using an ExpressionFactory, otherwise create a ValueExpression and evaluate it.String
getQName()
The qualified name for this attributeTag
getTag()
A reference to the Tag for which this class represents the attributes.String
getValue()
Return the literal value of this attributeString
getValue(FaceletContext ctx)
If literal, then return our value, otherwise delegate to getObject, passing String.class.jakarta.el.ValueExpression
getValueExpression(FaceletContext ctx, Class type)
Create a ValueExpression, using this attribute's literal value and the passed expected type.jakarta.el.ValueExpression
getValueExpression(FaceletContext ctx, String expr, Class type)
boolean
isLiteral()
If this TagAttributeImpl is literal (not #{..} or ${..})void
setTag(Tag tag)
Set a reference to the Tag for which this class represents the attributes.String
toString()
-
-
-
Method Detail
-
getBoolean
public boolean getBoolean(FaceletContext ctx)
If literal,return
Boolean.valueOf(java.lang.String)
passing our value, otherwise callgetObject(FaceletContext, Class)
.- Specified by:
getBoolean
in classTagAttribute
- Parameters:
ctx
- FaceletContext to use- Returns:
- boolean value
- See Also:
Boolean.valueOf(java.lang.String)
,getObject(FaceletContext, Class)
-
getInt
public int getInt(FaceletContext ctx)
If literal, callInteger.parseInt(String)
, otherwise callgetObject(FaceletContext, Class)
.- Specified by:
getInt
in classTagAttribute
- Parameters:
ctx
- FaceletContext to use- Returns:
- int value
- See Also:
Integer.parseInt(java.lang.String)
,getObject(FaceletContext, Class)
-
getLocalName
public String getLocalName()
Local name of this attribute- Specified by:
getLocalName
in classTagAttribute
- Returns:
- local name of this attribute
-
getLocation
public Location getLocation()
The location of this attribute in the FaceletContext- Specified by:
getLocation
in classTagAttribute
- Returns:
- the TagAttributeImpl's location
-
getMethodExpression
public jakarta.el.MethodExpression getMethodExpression(FaceletContext ctx, Class type, Class[] paramTypes)
Create a MethodExpression, using this attribute's value as the expression String.- Specified by:
getMethodExpression
in classTagAttribute
- Parameters:
ctx
- FaceletContext to usetype
- expected return typeparamTypes
- parameter type- Returns:
- a MethodExpression instance
- See Also:
ExpressionFactory.createMethodExpression(jakarta.el.ELContext, java.lang.String, java.lang.Class, java.lang.Class[])
,MethodExpression
-
getNamespace
public String getNamespace()
The resolved Namespace for this attribute- Specified by:
getNamespace
in classTagAttribute
- Returns:
- resolved Namespace
-
getObject
public Object getObject(FaceletContext ctx)
Delegates to getObject with Object.class as a param- Specified by:
getObject
in classTagAttribute
- Parameters:
ctx
- FaceletContext to use- Returns:
- Object representation of this attribute's value
- See Also:
getObject(FaceletContext, Class)
-
getQName
public String getQName()
The qualified name for this attribute- Specified by:
getQName
in classTagAttribute
- Returns:
- the qualified name for this attribute
-
getTag
public Tag getTag()
Description copied from class:TagAttribute
A reference to the Tag for which this class represents the attributes. For compatibility with previous implementations, an implementation is provided that returns
null
.- Overrides:
getTag
in classTagAttribute
- Returns:
- the
Tag
for which this class represents the attributes.
-
setTag
public void setTag(Tag tag)
Description copied from class:TagAttribute
Set a reference to the Tag for which this class represents the attributes. The VDL runtime must ensure that this method is called before any
FaceletHandler
s for this element are instantiated. For compatibility with previous implementations, a no-op implementation is provided.- Overrides:
setTag
in classTagAttribute
- Parameters:
tag
- the tag we represent.
-
getValue
public String getValue()
Return the literal value of this attribute- Specified by:
getValue
in classTagAttribute
- Returns:
- literal value
-
getValue
public String getValue(FaceletContext ctx)
If literal, then return our value, otherwise delegate to getObject, passing String.class.- Specified by:
getValue
in classTagAttribute
- Parameters:
ctx
- FaceletContext to use- Returns:
- String value of this attribute
- See Also:
getObject(FaceletContext, Class)
-
getObject
public Object getObject(FaceletContext ctx, Class type)
If literal, simply coerce our String literal value using an ExpressionFactory, otherwise create a ValueExpression and evaluate it.- Specified by:
getObject
in classTagAttribute
- Parameters:
ctx
- FaceletContext to usetype
- expected return type- Returns:
- Object value of this attribute
- See Also:
ExpressionFactory.coerceToType(java.lang.Object, java.lang.Class)
,ExpressionFactory.createValueExpression(jakarta.el.ELContext, java.lang.String, java.lang.Class)
,ValueExpression
-
getValueExpression
public jakarta.el.ValueExpression getValueExpression(FaceletContext ctx, Class type)
Create a ValueExpression, using this attribute's literal value and the passed expected type.- Specified by:
getValueExpression
in classTagAttribute
- Parameters:
ctx
- FaceletContext to usetype
- expected return type- Returns:
- ValueExpression instance
- See Also:
ExpressionFactory.createValueExpression(jakarta.el.ELContext, java.lang.String, java.lang.Class)
,ValueExpression
-
isLiteral
public boolean isLiteral()
If this TagAttributeImpl is literal (not #{..} or ${..})- Specified by:
isLiteral
in classTagAttribute
- Returns:
- true if this attribute is literal
-
getValueExpression
public jakarta.el.ValueExpression getValueExpression(FaceletContext ctx, String expr, Class type)
-
-