|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.NullSimon
class NullSimon
Null Simon implements Simon returned by the disabled Manager.getSimon(String)
or Manager.getRootSimon(). Null Simon does nothing, returns null
or zeroes wherever return value is expected and has minimal performance impact on the system.
| Field Summary | |
|---|---|
(package private) static NullSimon |
INSTANCE
Internal singleton value of the null Simon. |
| Constructor Summary | |
|---|---|
NullSimon()
Used only by the subclasses, otherwise should not be used at all except for a single INSTANCE. |
|
| Method Summary | ||
|---|---|---|
Object |
getAttribute(String name)
Returns null. |
|
|
getAttribute(String name,
Class<T> clazz)
Returns null. |
|
Iterator<String> |
getAttributeNames()
Returns empty iterator. |
|
Map<String,Object> |
getCopyAsSortedMap()
Returns empty set. |
|
long |
getFirstUsage()
Returns ms timestamp of the first usage of this Simon. |
|
List<Simon> |
getChildren()
Returns list of children - direct sub-simons. |
|
long |
getLastReset()
Returns ms timestamp of the last recent usage of the Simon.reset() method on the Simon. |
|
long |
getLastUsage()
Returns ms timestamp of the last usage of this Simon. |
|
String |
getName()
Returns Simon name. |
|
String |
getNote()
Returns note for the Simon. |
|
Simon |
getParent()
Returns parent Simon. |
|
SimonState |
getState()
Returns state of the Simon that can be enabled, disabled or ihnerited. |
|
boolean |
isEnabled()
Returns true, if the Simon is enabled or if the enabled state is inherited. |
|
void |
removeAttribute(String name)
Does nothing. |
|
NullSimon |
reset()
Resets the Simon values related to the measuring, timestamps and so on - usage timestamps, state, attributes are not affected. |
|
Sample |
sample()
Samples Simon values and returns them in a Java Bean derived from Sample interface. |
|
Sample |
sampleAndReset()
Samples Simon values and returns them in a Java Bean derived from Sample interface and resets the Simon. |
|
void |
setAttribute(String name,
Object value)
Does nothing. |
|
void |
setNote(String note)
Sets note for the Simon. |
|
void |
setState(SimonState state,
boolean overrule)
Sets the state of the Simon. |
|
String |
toString()
Returns string Null Simon. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final NullSimon INSTANCE
Simon interface - only its behavior manifests to the client.
| Constructor Detail |
|---|
NullSimon()
INSTANCE.
| Method Detail |
|---|
public Simon getParent()
Simon
getParent in interface Simonpublic final List<Simon> getChildren()
Simon
getChildren in interface Simonpublic String getName()
Simonnull for anonymous Simons.
getName in interface Simonpublic SimonState getState()
Simon
getState in interface Simon
public void setState(SimonState state,
boolean overrule)
Simon
setState in interface Simonstate - a new state.overrule - specifies whether this change is forced to the whole subtree.public boolean isEnabled()
Simon
isEnabled in interface Simonpublic NullSimon reset()
SimonSimon.getLastReset(). Reset is perfomed even for disabled Simons.
reset in interface Simonpublic long getLastReset()
SimonSimon.reset() method on the Simon.
Returns 0 if reset was not called yet. This timestamp is useful for rate measuring
when reset is called on a regular basis - likely via Simon.sampleAndReset(). While
client code could store the timestamp too it is not necessary with this method.
getLastReset in interface Simonpublic long getFirstUsage()
Simon
getFirstUsage in interface Simonpublic long getLastUsage()
Simon
getLastUsage in interface Simonpublic String getNote()
getNote in interface Simonpublic void setNote(String note)
setNote in interface Simonnote - note for the Simon.public Sample sample()
Simon
sample in interface Simonpublic Sample sampleAndReset()
Simon
sampleAndReset in interface Simon
public void setAttribute(String name,
Object value)
setAttribute in interface HasAttributesname - ignoredvalue - ignoredpublic Object getAttribute(String name)
null.
getAttribute in interface HasAttributesname - ignored
null
public <T> T getAttribute(String name,
Class<T> clazz)
null.
getAttribute in interface HasAttributesname - ignoredclazz - ignored
nullpublic void removeAttribute(String name)
removeAttribute in interface HasAttributesname - ignoredpublic Iterator<String> getAttributeNames()
getAttributeNames in interface HasAttributespublic Map<String,Object> getCopyAsSortedMap()
getCopyAsSortedMap in interface HasAttributespublic String toString()
Null Simon.
toString in class ObjectNull Simon
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||