Package org.apache.sling.scripting.jsp.taglib.tei

# Class AbstractVarTEI

java.lang.Object
javax.servlet.jsp.tagext.TagExtraInfo
org.apache.sling.scripting.jsp.taglib.tei.AbstractVarTEI

Direct Known Subclasses:
  `AdaptToTEI`, `GetPropertyTEI`, `ResourceIteratorVariableTEI`, `ResourceVariableTEI`, `StringVariableTEI`

public abstract class AbstractVarTEI extends javax.servlet.jsp.tagext.TagExtraInfo
Abstract TEI that that provides the type for a single variable named in the tag's "var" attribute.

The name of the attribute can be overwritten via a custom default constructor or by overwriting `getVariableName(javax.servlet.jsp.tagext.TagData)`.

All implementations need to overwrite `getClassName(javax.servlet.jsp.tagext.TagData)` in order to provide the type (class name) of the variable.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final String`
`ATTR_VAR`

## Constructor Summary

Constructors
Modifier
Constructor
Description
``
`AbstractVarTEI()`
`protected`
`AbstractVarTEI(String variableNameAttribute)`
Constructor that takes the name of the attribute that defines the variable name and the name of the attribute that defines the class name.

## Method Summary

Modifier and Type
Method
Description
`protected abstract String`
`getClassName(javax.servlet.jsp.tagext.TagData data)`
Provides the fully qualified class name of the variable injected into the `pageContext`.
`javax.servlet.jsp.tagext.VariableInfo[]`
`getVariableInfo(javax.servlet.jsp.tagext.TagData data)`
`protected String`
`getVariableName(javax.servlet.jsp.tagext.TagData data)`
Provides the name of the variable injected into the `pageContext`.

### Methods inherited from class javax.servlet.jsp.tagext.TagExtraInfo

`getTagInfo, isValid, setTagInfo, validate`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### ATTR_VAR

protected static final String ATTR_VAR

See Also:
  - Constant Field Values

## Constructor Details

### AbstractVarTEI

public AbstractVarTEI()

### AbstractVarTEI

protected AbstractVarTEI(String variableNameAttribute)
Constructor that takes the name of the attribute that defines the variable name and the name of the attribute that defines the class name.

Parameters:
  `variableNameAttribute` - Name of the attribute that defines the variable name.

## Method Details

### getVariableName

protected String getVariableName(javax.servlet.jsp.tagext.TagData data)
Provides the name of the variable injected into the `pageContext`.

Parameters:
  `data` - The TagData.
Returns:
  The variable name.

### getClassName

protected abstract String getClassName(javax.servlet.jsp.tagext.TagData data)
Provides the fully qualified class name of the variable injected into the `pageContext`.

Parameters:
  `data` - The TagData.
Returns:
  The class name of the variable's type.

### getVariableInfo

public javax.servlet.jsp.tagext.VariableInfo[] getVariableInfo(javax.servlet.jsp.tagext.TagData data)

Overrides:
  `getVariableInfo` in class `javax.servlet.jsp.tagext.TagExtraInfo`