Value - public class PullPushMeasure<Value> extends Object implements PullMeasure<Value>, PushMeasure<Value>
PullPushMeasure aims at providing both the PushMeasure and
PullMeasure abilities into a single Measure. One could simply
build a brand new Measure by calling
PullPushMeasure(String, String), but in the case where some existing
measures are available, he can wrap them into a PullPushMeasure by
calling PullPushMeasure(PushMeasure, Object) or other constructors
taking a Measure as argument.| Constructor and Description |
|---|
PullPushMeasure(PullMeasure<Value> pull,
PushMeasure<Value> push,
DescribedEntity reference)
|
PullPushMeasure(PullMeasure<Value> pull,
PushMeasure<Value> push,
String name,
String description)
Equivalent to
PullPushMeasure(PullMeasure, PushMeasure, DescribedEntity) but
the reference parameter is replaced by the specific name and description
that you want to provide. |
PullPushMeasure(PushMeasure<Value> push,
Value initialValue)
Create a
PullPushMeasure which wraps a PushMeasure. |
PullPushMeasure(String name,
String description)
Create a
PullPushMeasure from scratch. |
| Modifier and Type | Method and Description |
|---|---|
Value |
get() |
String |
getDescription() |
String |
getName() |
void |
register(MeasureListener<Value> listener)
|
void |
unregister(MeasureListener<Value> listener)
Unregister a
MeasureListener registered with
PushMeasure.register(MeasureListener) to stop receiving the notifications of
the PushMeasure. |
public PullPushMeasure(PullMeasure<Value> pull, PushMeasure<Value> push, DescribedEntity reference)
PullPushMeasure which wraps both a PullMeasure
and a PushMeasure. The assumption is that both Measures
already represent the same Measure (i.e. the same Value)
but were implemented separately. Instantiating a PullPushMeasure
this way allows to merge them easily without creating a completely new
measure. Don't use this constructor to merge two different
Measures. The last parameter is generally used to specify which
of the two Measures should be used for getName() and
getDescription(), but you can also provide a completely new
instance to change them.pull - the PullMeasure to wrappush - the PushMeasure to wrapreference - the reference to use for the name and the description of this
PullPushMeasurepublic PullPushMeasure(PullMeasure<Value> pull, PushMeasure<Value> push, String name, String description)
PullPushMeasure(PullMeasure, PushMeasure, DescribedEntity) but
the reference parameter is replaced by the specific name and description
that you want to provide. This is a shortcut to the creation of the
DescribedEntity instance followed by the call of the
reference-based method.pull - the PullMeasure to wrappush - the PushMeasure to wrapname - the name of the PullPushMeasuredescription - the description of the PullPushMeasurepublic PullPushMeasure(PushMeasure<Value> push, Value initialValue)
PullPushMeasure which wraps a PushMeasure. The
PullMeasure ability corresponds the storage of the Value
pushed by the PushMeasure in order to retrieve it on demand
through PullMeasure.get(). The name and the description of the
PullPushMeasure are the ones provided by the wrapped
PushMeasure.push - the PushMeasure to wrapsinitialValue - the Value to return before the next notification of
the PushMeasurepublic PullPushMeasure(String name, String description)
PullPushMeasure from scratch.name - the name of the PullPushMeasuredescription - the description of the PullPushMeasurepublic void register(MeasureListener<Value> listener)
PushMeasureregister in interface PushMeasure<Value>listener - the MeasureListener to registerpublic void unregister(MeasureListener<Value> listener)
PushMeasureMeasureListener registered with
PushMeasure.register(MeasureListener) to stop receiving the notifications of
the PushMeasure.unregister in interface PushMeasure<Value>listener - the MeasureListener to unregisterpublic Value get()
get in interface PullMeasure<Value>Value of the Measurepublic String getName()
getName in interface DescribedEntityDescribedEntitypublic String getDescription()
getDescription in interface DescribedEntityDescribedEntityCopyright © 2017. All rights reserved.