org.apache.tapestry5.services.pageload

## Class ComponentResourceSelector

- java.lang.Object
- - org.apache.tapestry5.services.pageload.ComponentResourceSelector

-     public final class ComponentResourceSelector
      extends Object

  Encapsulates the information that is used when locating a template or message catalog associated with a component. The selector is combined with the component class name to locate the other resources. The selector defines one or more axes that are combined with a `ComponentResourceLocator` implementation to enforce a naming convention for locating resources. The primary axis is `Locale` (Tapestry 5.2 and earlier used a Locale instance as the selector), but Tapestry 5.3 adds support for additional axes.
  Since:
    5.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Locale` | `locale`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ComponentResourceSelector(Locale locale)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)` Returns true if the object is another selector with the same locale and set of axis.
    `<T> T` | `getAxis(Class<T> axisType)` Returns a previously stored axis value, or null if no axis value of the specified type has been stored.
    `int` | `hashCode()`
    `String` | `toShortString()` Returns a string identifying the locale, and any additional axis types and values.
    `String` | `toString()`
    `<T> ComponentResourceSelector` | `withAxis(Class<T> axisType, T axisValue)` Returns a new selector with the given axis data.

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

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

- - ### Field Detail

    - #### locale

          public final Locale locale

  - ### Constructor Detail

    - #### ComponentResourceSelector

          public ComponentResourceSelector(Locale locale)

  - ### Method Detail

    - #### withAxis

          public <T> ComponentResourceSelector withAxis(Class<T> axisType,
                                                        T axisValue)

      Returns a new selector with the given axis data. It is not allowed to redefine an existing axis type. Typically, the axis type is an enum type. Axis values are expected to be immutable, and to implement `equals()` and `hashCode()`.
      Parameters:
        `axisType` - non-blank axis key
        `axisValue` - non-null axis value
      Returns:
        new selector including axis value

    - #### getAxis

          public <T> T getAxis(Class<T> axisType)

      Returns a previously stored axis value, or null if no axis value of the specified type has been stored.
      Type Parameters:
        `T` -
      Parameters:
        `axisType` -
      Returns:
        value or null

    - #### equals

          public boolean equals(Object obj)

      Returns true if the object is another selector with the same locale and set of axis.
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toShortString

          public String toShortString()

      Returns a string identifying the locale, and any additional axis types and values. Example, "en" or "fr com.example.Skin=RED".

${project.version} - Copyright © 2003-2015 The Apache Software Foundation.