org.apache.tiles.api

## Class Attribute

- java.lang.Object
- - org.apache.tiles.api.Attribute

- Direct Known Subclasses:
    ListAttribute

      public class Attribute
      extends Object

  Common implementation of attribute definition.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Attribute()` Constructor.
    `Attribute(Attribute attribute)` Copy constructor.
    `Attribute(Object value)` Constructor.
    `Attribute(Object value, Expression expression, String role, String rendererName)` Constructor.
    `Attribute(Object value, String role)` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Attribute` | `copy()`
    `static Attribute` | `createTemplateAttribute(String template)` Creates a template attribute, starting from the name of the template.
    `static Attribute` | `createTemplateAttribute(String template, String templateExpression, String templateType, String role)` Creates a template attribute, starting from the name of the template.
    `boolean` | `equals(Object obj)`
    `Expression` | `getExpressionObject()` Returns The expression to evaluate.
    `String` | `getRenderer()` Returns the renderer name to use.
    `String` | `getRole()` Get role.
    `Set<String>` | `getRoles()` Returns the roles that can render this attribute.
    `Object` | `getValue()` Get value.
    `int` | `hashCode()`
    `void` | `inherit(Attribute attribute)` Inherits an attribute, i.e.
    `boolean` | `isPermitted(Request request)` Checks if the current user can use this attribute.
    `void` | `setExpressionObject(Expression expressionObject)` Sets The expression to evaluate.
    `void` | `setRenderer(String rendererName)` Sets the renderer name to use.
    `void` | `setRole(String role)` Set role.
    `void` | `setRoles(Set<String> roles)` Sets the roles that can render this attribute.
    `void` | `setValue(Object value)` Set value.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Attribute

          public Attribute()

      Constructor.

    - #### Attribute

          public Attribute(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(Object value,
                           String role)

      Constructor.
      Parameters:
        `value` - Object to store.
        `role` - Asociated role.

    - #### Attribute

          public Attribute(Object value,
                           Expression expression,
                           String role,
                           String rendererName)

      Constructor.
      Parameters:
        `value` - Object to store. If specified, the `expression` parameter will be ignored.
        `expression` - The expression to be evaluated. Ignored if the `value` is not null.
        `role` - Associated role.
        `rendererName` - The renderer name.
      Since:
        2.2.0

  - ### Method Detail

    - #### createTemplateAttribute

          public static Attribute createTemplateAttribute(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(String template,
                                                          String templateExpression,
                                                          String templateType,
                                                          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 default `template` 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

    - #### getRole

          public String getRole()

      Get role.
      Returns:
        the name of the required role(s)

    - #### getRoles

          public Set<String> getRoles()

      Returns the roles that can render this attribute.
      Returns:
        The enabled roles.
      Since:
        2.0.6

    - #### setRole

          public void setRole(String role)

      Set role.
      Parameters:
        `role` - Associated role.

    - #### setRoles

          public void setRoles(Set<String> roles)

      Sets the roles that can render this attribute.
      Parameters:
        `roles` - The enabled roles.
      Since:
        2.0.6

    - #### getValue

          public Object getValue()

      Get value.
      Returns:
        the value

    - #### setValue

          public void setValue(Object value)

      Set value.
      Parameters:
        `value` - New value.

    - #### getExpressionObject

          public Expression getExpressionObject()

      Returns The expression to evaluate. Ignored if `value` is not `null`.
      Returns:
        The expression to be evaluated.
      Since:
        2.2.0

    - #### setExpressionObject

          public void setExpressionObject(Expression expressionObject)

      Sets The expression to evaluate. Ignored if `value` is not `null`.
      Parameters:
        `expressionObject` - The expression to be evaluated.
      Since:
        2.2.0

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getRenderer

          public String getRenderer()

      Returns the renderer name to use.
      Returns:
        The renderer name.
      Since:
        2.1.0

    - #### setRenderer

          public void setRenderer(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(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### isPermitted

          public boolean isPermitted(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 class `Object`

    - #### copy

          public Attribute copy()

Copyright © 2000–2024 Apache Software Foundation. All rights reserved.