@PublicAPI(stability=PRIVATE) public final class MonitorData extends Object implements Iterable<Attribute>
Note:
Creating monitor entries may become a lot easier once we've migrated to the SDK Entry class:
Entry entry = ...;
entry.addAttribute("stringStat", "aString")
.addAttribute("integerStat", 12345)
.addAttribute("dnStat", DN.valueOf("dc=aDN");
We could also envisage an annotation based approach where we determine the monitor content from
annotated fields/methods in an object.| Constructor and Description |
|---|
MonitorData()
Constructor to use when the number of attributes to create is unknown.
|
MonitorData(int expectedAttributesCount)
Constructor that accepts the number of attributes to create.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String attrName,
Collection<?> attrValues)
Adds an attribute with the provided name and values.
|
void |
add(String attrName,
Object attrValue)
Adds an attribute with the provided name and value.
|
void |
addBean(Object bean,
String attributesPrefix)
Adds all the properties from the provided bean as attributes, prepending the provided prefix.
|
void |
addIfNotNull(String attrName,
Object attrValue)
Adds an attribute with the provided name and value if the value is not null.
|
Iterator<Attribute> |
iterator() |
int |
size()
Returns the number of attributes.
|
String |
toString() |
public MonitorData()
public MonitorData(int expectedAttributesCount)
expectedAttributesCount - number of attributes that will be addedpublic void add(String attrName, Object attrValue)
attrName - the attribute nameattrValue - the attribute valuepublic void addIfNotNull(String attrName, Object attrValue)
attrName - the attribute nameattrValue - the attribute valuepublic void add(String attrName, Collection<?> attrValues)
attrName - the attribute nameattrValues - the attribute valuespublic void addBean(Object bean, String attributesPrefix) throws ReflectiveOperationException
bean - the bean from which to read the propertiesattributesPrefix - the prefix to prepend to the attributes read from the beanReflectiveOperationException - if a problem occurs while reading the properties of the beanpublic int size()
Copyright © 2010-2018 ForgeRock AS. All Rights Reserved.