@Deprecated public final class Symbol extends Object implements Serializable
Interface to persistent symbols.
A Symbol is an inexpensive object that behaves like a singleton – except that you can create as many as you want. Each Symbol is created with a String, and a unique Symbol is assigned to this String. Any fetches of that String will return the same Symbol.
Symbols cannot be constructed, but must be fetched through the “of” operator.
Symbols are hashable, because they are singletons, so the default hashCode based on Object address should work.
Modifier and Type | Method and Description |
---|---|
String |
getName()
Deprecated.
Get the name for a symbol.
|
static Symbol |
of(String name)
Deprecated.
Get a unique symbol for name.
|
String |
toString()
Deprecated.
|
<T> TypedSymbol<T> |
withType(Class<T> type)
Deprecated.
Make a typed symbol from this symbol.
|
public static Symbol of(String name)
Get a unique symbol for name.
name
- the name for this symbol during this execution of the programpublic String getName()
Get the name for a symbol.
public <T> TypedSymbol<T> withType(Class<T> type)
Make a typed symbol from this symbol.
type
- The type.T
- The type.