# Class UserConstant<T>

java.lang.Object
uk.ac.starlink.topcat.UserConstant<T>

All Implemented Interfaces:
  `uk.ac.starlink.ttools.jel.Constant<T>`

public class UserConstant<T> extends Object implements uk.ac.starlink.ttools.jel.Constant<T>
Named JEL value that can be set by users for use in expressions. This is constant in the sense that it does not vary with row index, but its value can be changed by the user.

Since:
  30 Jun 2025
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`UserConstant(Class<T> clazz, String name, T value)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Class<T>`
`getContentClass()`
Returns the value type for this constant.
`String`
`getName()`
Returns the name of this constant.
`T`
`getValue()`
Returns the value of this constant.
`boolean`
`requiresRowIndex()`
returns false
`void`
`setName(String name)`
Sets the name of this constant.
`void`
`setValue(T value)`
Sets the value of this constant.
`String`
`toString()`

### Methods inherited from class Object

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

## Constructor Details

### UserConstant

public UserConstant(Class<T> clazz, String name, T value)
Constructor.

Parameters:
  `clazz` - value type
  `name` - constant name for use in JEL expressions
  `value` - initial value

## Method Details

### getContentClass

public Class<T> getContentClass()
Returns the value type for this constant.

Specified by:
  `getContentClass` in interface `uk.ac.starlink.ttools.jel.Constant<T>`
Returns:
  class

### getName

public String getName()
Returns the name of this constant.

Returns:
  name as used in JEL expressions

### setName

public void setName(String name)
Sets the name of this constant.

Parameters:
  `name` - new name

### getValue

public T getValue()
Returns the value of this constant.

Specified by:
  `getValue` in interface `uk.ac.starlink.ttools.jel.Constant<T>`
Returns:
  current value

### setValue

public void setValue(T value)
Sets the value of this constant.

Parameters:
  `value` - new value

### requiresRowIndex

public boolean requiresRowIndex()
returns false

Specified by:
  `requiresRowIndex` in interface `uk.ac.starlink.ttools.jel.Constant<T>`

### toString

public String toString()

Overrides:
  `toString` in class `Object`