org.apache.myfaces.view.facelets.tag
Class TagAttributeImpl

java.lang.Object
  extended by javax.faces.view.facelets.TagAttribute
      extended by org.apache.myfaces.view.facelets.tag.TagAttributeImpl

public final class TagAttributeImpl
extends TagAttribute

Representation of a Tag's attribute in a Facelet File

Version:
$Id: TagAttributeImpl.java 1383169 2012-09-10 23:57:55Z lu4242 $
Author:
Jacob Hookom

Constructor Summary
TagAttributeImpl(Location location, String ns, String localName, String qName, String value)
           
 
Method Summary
 boolean getBoolean(FaceletContext ctx)
          If literal, return Boolean.getBoolean(java.lang.String) passing our value, otherwise call getObject(FaceletContext, Class).
 int getInt(FaceletContext ctx)
          If literal, call Integer.parseInt(String), otherwise call getObject(FaceletContext, Class).
 String getLocalName()
          Local name of this attribute
 Location getLocation()
          The location of this attribute in the FaceletContext
 javax.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 attribute
 Object getObject(FaceletContext ctx)
          Delegates to getObject with Object.class as a param
 Object 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 attribute
 String getValue()
          Return the literal value of this attribute
 String getValue(FaceletContext ctx)
          If literal, then return our value, otherwise delegate to getObject, passing String.class.
 javax.el.ValueExpression getValueExpression(FaceletContext ctx, Class type)
          Create a ValueExpression, using this attribute's literal value and the passed expected type.
 boolean isLiteral()
          If this TagAttribute is literal (not #{..} or ${..})
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TagAttributeImpl

public TagAttributeImpl(Location location,
                        String ns,
                        String localName,
                        String qName,
                        String value)
Method Detail

getBoolean

public boolean getBoolean(FaceletContext ctx)
If literal, return Boolean.getBoolean(java.lang.String) passing our value, otherwise call getObject(FaceletContext, Class).

Specified by:
getBoolean in class TagAttribute
Parameters:
ctx - FaceletContext to use
Returns:
boolean value
See Also:
Boolean.getBoolean(java.lang.String), getObject(FaceletContext, Class)

getInt

public int getInt(FaceletContext ctx)
If literal, call Integer.parseInt(String), otherwise call getObject(FaceletContext, Class).

Specified by:
getInt in class TagAttribute
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 class TagAttribute
Returns:
local name of this attribute

getLocation

public Location getLocation()
The location of this attribute in the FaceletContext

Specified by:
getLocation in class TagAttribute
Returns:
the TagAttribute's location

getMethodExpression

public javax.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 class TagAttribute
Parameters:
ctx - FaceletContext to use
type - expected return type
paramTypes - parameter type
Returns:
a MethodExpression instance
See Also:
ExpressionFactory.createMethodExpression(javax.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 class TagAttribute
Returns:
resolved Namespace

getObject

public Object getObject(FaceletContext ctx)
Delegates to getObject with Object.class as a param

Specified by:
getObject in class TagAttribute
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 class TagAttribute
Returns:
the qualified name for this attribute

getValue

public String getValue()
Return the literal value of this attribute

Specified by:
getValue in class TagAttribute
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 class TagAttribute
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 class TagAttribute
Parameters:
ctx - FaceletContext to use
type - expected return type
Returns:
Object value of this attribute
See Also:
ExpressionFactory.coerceToType(java.lang.Object, java.lang.Class), ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class), ValueExpression

getValueExpression

public javax.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 class TagAttribute
Parameters:
ctx - FaceletContext to use
type - expected return type
Returns:
ValueExpression instance
See Also:
ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class), ValueExpression

isLiteral

public boolean isLiteral()
If this TagAttribute is literal (not #{..} or ${..})

Specified by:
isLiteral in class TagAttribute
Returns:
true if this attribute is literal

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.