Package org.spongepowered.configurate
Class RepresentationHint<V>
- java.lang.Object
-
- org.spongepowered.configurate.RepresentationHint<V>
-
- Type Parameters:
V
- the value type
public abstract class RepresentationHint<V> extends Object
A flag for configuration loaders describing how a node should be serialized.A loader may not accept every representation hint available, but any understood hints should be exposed as constant fields on the loader class. Any unknown hints will be ignored.
- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RepresentationHint.Builder<V>
A builder forRepresentationHint
s.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <V> RepresentationHint.Builder<V>
builder()
Create a builder for a new hint.abstract @Nullable V
defaultValue()
If a value for a representation hint cannot be found by quering a node or any of this parents, the default value will be returned.abstract String
identifier()
An identifier used to represent this hint in error messages.abstract boolean
inheritable()
Get whether or not this hint can draw its value from parent nodes.static <V> RepresentationHint<V>
of(String identifier, TypeToken<V> valueType)
Create a new basic representation hint.static <V> RepresentationHint<V>
of(String identifier, Class<V> valueType)
Create a new basic representation hint.abstract TypeToken<V>
valueType()
The type that values of this type have to have.
-
-
-
Method Detail
-
of
public static <V> RepresentationHint<V> of(String identifier, Class<V> valueType)
Create a new basic representation hint.The created hint will be inheritable and have no default value set.
- Type Parameters:
V
- value type- Parameters:
identifier
- hint identifiervalueType
- type of value the hint will hold- Returns:
- a new hint
- Since:
- 4.0.0
-
of
public static <V> RepresentationHint<V> of(String identifier, TypeToken<V> valueType)
Create a new basic representation hint.The created hint will be inheritable and have no default value set.
- Type Parameters:
V
- value type- Parameters:
identifier
- hint identifiervalueType
- type of value the hint will hold- Returns:
- a new hint
- Since:
- 4.0.0
-
builder
public static <V> RepresentationHint.Builder<V> builder()
Create a builder for a new hint.- Type Parameters:
V
- value type- Returns:
- a new builder
- Since:
- 4.0.0
-
identifier
public abstract String identifier()
An identifier used to represent this hint in error messages.- Returns:
- the identifier
- Since:
- 4.0.0
-
valueType
public abstract TypeToken<V> valueType()
The type that values of this type have to have.- Returns:
- value type
- Since:
- 4.0.0
-
defaultValue
public abstract @Nullable V defaultValue()
If a value for a representation hint cannot be found by quering a node or any of this parents, the default value will be returned.- Returns:
- default type
- Since:
- 4.0.0
-
inheritable
public abstract boolean inheritable()
Get whether or not this hint can draw its value from parent nodes.- Returns:
- if inheritable
- Since:
- 4.0.0
-
-