public final class PropertyMirrorImpl<R,S> extends Object implements PropertyMirror<R>
| Modifier and Type | Field and Description |
|---|---|
protected Property<S> |
delegate |
protected ConfigType<R,S,?> |
mirroredType |
| Constructor and Description |
|---|
PropertyMirrorImpl(ConfigType<R,S,?> mirroredType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(R value)
Returns
true if this property can be set to the given value. |
Property<?> |
getMirrored()
Returns the mirrored property.
|
ConfigType<R,S,?> |
getMirroredType()
Returns the
ConfigType of the mirrored property. |
Class<R> |
getType()
Returns the class of the type of the value being held.
|
R |
getValue()
Returns the value being held.
|
void |
mirror(Property<?> delegate)
Sets a property to mirror.
|
boolean |
setValue(R value)
Sets the value of this property.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateprotected ConfigType<R,S,?> mirroredType
public PropertyMirrorImpl(ConfigType<R,S,?> mirroredType)
public void mirror(Property<?> delegate)
After calling this method with a valid delegate,
every property method will redirect to delegate.
mirror in interface PropertyMirror<R>delegate - a property to mirrorpublic Property<?> getMirrored()
PropertyMirrorgetMirrored in interface PropertyMirror<R>public boolean setValue(@Nonnull R value)
PropertyThis can fail and return false if, for example, the value did not satisfy the constraints of the property.
This operation can still succeed with a rejected value,
if eg. a corrected value can be found.
setValue in interface Property<R>value - the new value this property should receivetrue if this property changed as a result of the callProperty.accepts(Object)public boolean accepts(@Nonnull R value)
Propertytrue if this property can be set to the given value.accepts in interface Property<R>value - the value to checktrue if this property accepts the given value, false otherwise.Property.setValue(Object)@Nonnull public R getValue()
HasValuepublic Class<R> getType()
HasValuepublic ConfigType<R,S,?> getMirroredType()
PropertyMirrorConfigType of the mirrored property.getMirroredType in interface PropertyMirror<R>