T - the type of value this property mirrorspublic interface PropertyMirror<T> extends Property<T>
Property that delegates all operations to another.
This can be used in conjunction with config builders to easily setup a configuration without reflection. For example:
public final PropertyMirror<Integer> diamondsDropped = new PropertyMirror<>();
private final Node config = ConfigNode.builder()
.beginValue("diamondsDropped", Integer.class)
.beginConstraints().atLeast(1).finishConstraints()
.finishValue(diamondsDropped::mirror)
.build();
| Modifier and Type | Method and Description |
|---|---|
static <T> PropertyMirror<T> |
create(ConfigType<T,?,?> converter)
Creates a new
PropertyMirror that can mirror values of the given ConfigType. |
Property<?> |
getMirrored()
Returns the mirrored property.
|
ConfigType<T,?,?> |
getMirroredType()
Returns the
ConfigType of the mirrored property. |
void |
mirror(Property<?> delegate)
Sets a property to mirror.
|
static <T> PropertyMirror<T> create(ConfigType<T,?,?> converter)
PropertyMirror that can mirror values of the given ConfigType.T - The type of the mirrored values.converter - The ConfigType of the mirrored values.void mirror(Property<?> delegate)
After calling this method with a valid delegate,
every property method will redirect to delegate.
delegate - a property to mirrorProperty<?> getMirrored()
ConfigType<T,?,?> getMirroredType()
ConfigType of the mirrored property.