public interface TokenPropertyProvider<T extends TokenId>
final class MyTokenPropertyProvider implements TokenPropertyProvider { private final Object value; TokenPropProvider(Object value) { this.value = value; } public Object getValue (Token token, Object key) { if ("type".equals(key)) return value; return null; } }
final class MyTokenPropertyProvider implements TokenPropertyProvider { static final MyTokenPropertyProvider TRUE = new MyTokenPropertyProvider(Boolean.TRUE); static final MyTokenPropertyProvider FALSE = new MyTokenPropertyProvider(Boolean.FALSE); private final Boolean value; private MyTokenPropertyProvider(Boolean value) { this.value = value; } public Object getValue(Token<T> token, Object key) { if ("key".equals(key)) { return value; } return null; } }
PropertyToken
allows to carry token properties.Modifier and Type | Method and Description |
---|---|
Object |
getValue(Token<T> token,
Object key)
Get value of a token property.
|
Object getValue(Token<T> token, Object key)
token
- non-null token for which the property is being retrieved.
It might be useful if the property would be computed dynamically.key
- non-null key for which the value should be retrieved.