use of org.opennms.netmgt.collection.api.CollectionSetVisitor in project opennms by OpenNMS.
the class MockCollectionResource method visit.
@Override
public void visit(CollectionSetVisitor visitor) {
for (Entry<String, String> entry : attributes.entrySet()) {
final CollectionResource resource = this;
final String attrName = entry.getKey();
final String attrValue = entry.getValue();
CollectionAttribute attribute = new CollectionAttribute() {
@Override
public CollectionResource getResource() {
return resource;
}
@Override
public String getStringValue() {
return attrValue;
}
@Override
public Double getNumericValue() {
try {
return Double.parseDouble(attrValue);
} catch (NumberFormatException | NullPointerException e) {
return null;
}
}
@Override
public String getName() {
return attrName;
}
@Override
public void storeAttribute(Persister persister) {
}
@Override
public boolean shouldPersist(ServiceParameters params) {
return true;
}
@Override
public CollectionAttributeType getAttributeType() {
return null;
}
@Override
public void visit(CollectionSetVisitor visitor) {
}
@Override
public AttributeType getType() {
return AttributeType.STRING;
}
@Override
public String getMetricIdentifier() {
return "MOCK_" + getName();
}
};
visitor.visitAttribute(attribute);
}
}
Aggregations