String type = null;
String idAsString = null;
while (fieldNames.hasNext())
{
String fieldName = fieldNames.next();
JsonNode fieldNode = parent.get(fieldName);
if (fieldName.equals(ID))
{
idAsString = fieldNode.asText();
}
else if (fieldName.equals(TYPE))
{
type = fieldNode.asText();
}
else if (fieldNode.isArray())
{
// array containing either broker children or attribute values
Iterator<JsonNode> elements = fieldNode.getElements();
List<Object> fieldValues = null;
while (elements.hasNext())
{
JsonNode element = elements.next();
if (element.isObject())
{
Class<? extends ConfiguredObject> expectedChildConfiguredObjectClass = findExpectedChildConfiguredObjectClass(
fieldName, expectedConfiguredObjectClass);
// assuming it is a child node