Package org.apache.tiles
Class Attribute
- java.lang.Object
-
- org.apache.tiles.Attribute
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ListAttribute
public class Attribute extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
Common implementation of attribute definition.- Version:
- $Rev: 1035061 $ $Date: 2010-11-15 07:32:50 +1100 (Mon, 15 Nov 2010) $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Expression
expressionObject
The expression to evaluate.protected java.util.Set<java.lang.String>
roles
The roles that can render this attribute.protected java.lang.Object
value
The value of the attribute.
-
Constructor Summary
Constructors Constructor Description Attribute()
Constructor.Attribute(java.lang.Object value)
Constructor.Attribute(java.lang.Object value, java.lang.String role)
Constructor.Attribute(java.lang.Object value, Expression expression, java.lang.String role, java.lang.String rendererName)
Constructor.Attribute(Attribute attribute)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Attribute
clone()
static Attribute
createTemplateAttribute(java.lang.String template)
Creates a template attribute, starting from the name of the template.static Attribute
createTemplateAttribute(java.lang.String template, java.lang.String templateExpression, java.lang.String templateType, java.lang.String role)
Creates a template attribute, starting from the name of the template.static Attribute
createTemplateAttributeWithExpression(java.lang.String templateExpression)
Creates a template attribute, starting from the expression to evaluate to obtain the template.boolean
equals(java.lang.Object obj)
Expression
getExpressionObject()
Returns The expression to evaluate.java.lang.String
getRenderer()
Returns the renderer name to use.java.lang.String
getRole()
Get role.java.util.Set<java.lang.String>
getRoles()
Returns the roles that can render this attribute.java.lang.Object
getValue()
Get value.int
hashCode()
void
inherit(Attribute attribute)
Inherits an attribute, i.e.boolean
isPermitted(org.apache.tiles.request.Request request)
Checks if the current user can use this attribute.void
setExpressionObject(Expression expressionObject)
Sets The expression to evaluate.void
setRenderer(java.lang.String rendererName)
Sets the renderer name to use.void
setRole(java.lang.String role)
Set role.void
setRoles(java.util.Set<java.lang.String> roles)
Sets the roles that can render this attribute.void
setValue(java.lang.Object value)
Set value.java.lang.String
toString()
-
-
-
Field Detail
-
roles
protected java.util.Set<java.lang.String> roles
The roles that can render this attribute.- Since:
- 2.0.6
-
value
protected java.lang.Object value
The value of the attribute.
-
expressionObject
protected Expression expressionObject
The expression to evaluate. Ignored ifvalue
is notnull
.- Since:
- 2.2.0
-
-
Constructor Detail
-
Attribute
public Attribute()
Constructor.
-
Attribute
public Attribute(java.lang.Object value)
Constructor.- Parameters:
value
- Object to store.
-
Attribute
public Attribute(Attribute attribute)
Copy constructor.- Parameters:
attribute
- The attribute to copy from.
-
Attribute
public Attribute(java.lang.Object value, java.lang.String role)
Constructor.- Parameters:
value
- Object to store.role
- Asociated role.
-
Attribute
public Attribute(java.lang.Object value, Expression expression, java.lang.String role, java.lang.String rendererName)
Constructor.- Parameters:
value
- Object to store. If specified, theexpression
parameter will be ignored.expression
- The expression to be evaluated. Ignored if thevalue
is not null.role
- Associated role.rendererName
- The renderer name.- Since:
- 2.2.0
-
-
Method Detail
-
createTemplateAttribute
public static Attribute createTemplateAttribute(java.lang.String template)
Creates a template attribute, starting from the name of the template.- Parameters:
template
- The template that will be rendered.- Returns:
- The template attribute.
- Since:
- 2.1.2
-
createTemplateAttribute
public static Attribute createTemplateAttribute(java.lang.String template, java.lang.String templateExpression, java.lang.String templateType, java.lang.String role)
Creates a template attribute, starting from the name of the template.- Parameters:
template
- The template that will be rendered.templateExpression
- The template expression that will be evaluated to a template.templateType
- The type, or renderer, of the template. If null, the defaulttemplate
will be used.role
- The comma-separated roles for which the template is authorized to be rendered.- Returns:
- The template attribute.
- Since:
- 2.2.2
-
createTemplateAttributeWithExpression
public static Attribute createTemplateAttributeWithExpression(java.lang.String templateExpression)
Creates a template attribute, starting from the expression to evaluate to obtain the template.- Parameters:
templateExpression
- The expression to evaluate.- Returns:
- The template attribute.
- Since:
- 2.1.2
-
getRole
public java.lang.String getRole()
Get role.- Returns:
- the name of the required role(s)
-
getRoles
public java.util.Set<java.lang.String> getRoles()
Returns the roles that can render this attribute.- Returns:
- The enabled roles.
- Since:
- 2.0.6
-
setRole
public void setRole(java.lang.String role)
Set role.- Parameters:
role
- Associated role.
-
setRoles
public void setRoles(java.util.Set<java.lang.String> roles)
Sets the roles that can render this attribute.- Parameters:
roles
- The enabled roles.- Since:
- 2.0.6
-
getValue
public java.lang.Object getValue()
Get value.- Returns:
- the value
-
setValue
public void setValue(java.lang.Object value)
Set value.- Parameters:
value
- New value.
-
getExpressionObject
public Expression getExpressionObject()
Returns The expression to evaluate. Ignored ifvalue
is notnull
.- Returns:
- The expression to be evaluated.
- Since:
- 2.2.0
-
setExpressionObject
public void setExpressionObject(Expression expressionObject)
Sets The expression to evaluate. Ignored ifvalue
is notnull
.- Parameters:
expressionObject
- The expression to be evaluated.- Since:
- 2.2.0
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getRenderer
public java.lang.String getRenderer()
Returns the renderer name to use.- Returns:
- The renderer name.
- Since:
- 2.1.0
-
setRenderer
public void setRenderer(java.lang.String rendererName)
Sets the renderer name to use.- Parameters:
rendererName
- The renderer.- Since:
- 2.1.0
-
inherit
public void inherit(Attribute attribute)
Inherits an attribute, i.e. overwrites null properties with the ones provided by the attribute.- Parameters:
attribute
- The attribute to inherit.- Since:
- 2.1.2
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
isPermitted
public boolean isPermitted(org.apache.tiles.request.Request request)
Checks if the current user can use this attribute.- Parameters:
request
- The request context.- Returns:
true
if the current user can see this attribute.- Since:
- 3.0.0
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
clone
public Attribute clone()
- Overrides:
clone
in classjava.lang.Object
-
-