Package com.avanza.astrix.config
Class DynamicLongProperty
- java.lang.Object
-
- com.avanza.astrix.config.DynamicLongProperty
-
- All Implemented Interfaces:
DynamicProperty<Long>,LongSupplier
public final class DynamicLongProperty extends Object implements DynamicProperty<Long>, LongSupplier
DynamicProperty of int type, seeDynamicProperty.- Author:
- Elias Lindholm (elilin)
-
-
Constructor Summary
Constructors Constructor Description DynamicLongProperty()DynamicLongProperty(long initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(DynamicPropertyListener<Long> listener)Adds a given listener to the underlying property.longget()longgetAsLong()LonggetCurrentValue()Returns the current value of this DynamicProperty.voidremoveListener(DynamicPropertyListener<Long> listener)Removes a given listener.voidset(long value)voidsetValue(Long value)Sets the value of this DynamicProperty.StringtoString()
-
-
-
Method Detail
-
getCurrentValue
public Long getCurrentValue()
Description copied from interface:DynamicPropertyReturns the current value of this DynamicProperty. For primitive types the boxed version is returned (never null).- Specified by:
getCurrentValuein interfaceDynamicProperty<Long>
-
get
public long get()
-
getAsLong
public long getAsLong()
- Specified by:
getAsLongin interfaceLongSupplier
-
set
public void set(long value)
-
setValue
public void setValue(Long value)
Description copied from interface:DynamicPropertySets the value of this DynamicProperty. If the underlying property is a primitive type then this method throwsNullPointerExceptionwhen passing a null argument. All other DynamicProperty types accepts null as a value.- Specified by:
setValuein interfaceDynamicProperty<Long>
-
addListener
public void addListener(DynamicPropertyListener<Long> listener)
Description copied from interface:DynamicPropertyAdds a given listener to the underlying property. The listener will be notified each time the property value changes.Events are not guaranteed to be received in the same order as the underlying property is set.
The listener will be notified synchronously on the same thread that mutates the underlying property, so don't do any long-running work on the thread that notifies the
DynamicPropertyListener.- Specified by:
addListenerin interfaceDynamicProperty<Long>
-
removeListener
public void removeListener(DynamicPropertyListener<Long> listener)
Description copied from interface:DynamicPropertyRemoves a given listener. After remove the given listener will not receive events when this property is changed.- Specified by:
removeListenerin interfaceDynamicProperty<Long>
-
-