Property property = PropertyParser.parse(resolvedPropertyName, false);
if (!(property instanceof NestedProperty))
{
throw new IllegalStateException("Expected a nested property providing an index for array match '" + resolvedPropertyName + "'");
}
NestedProperty nested = ((NestedProperty) property);
if (nested.getProperties().size() < 2)
{
throw new IllegalStateException("Expected a nested property name for array match '" + resolvedPropertyName + "', none found");
}
if (!(nested.getProperties().get(0) instanceof IndexedProperty))
{
throw new IllegalStateException("Expected an indexed property for array match '" + resolvedPropertyName + "', please provide an index");
}
int index = ((IndexedProperty) nested.getProperties().get(0)).getIndex();
nested.getProperties().remove(0);
StringWriter writer = new StringWriter();
nested.toPropertyEPL(writer);
return new Pair<Integer, String>(index, writer.toString());
}