}
// both fields and properties are sorted by name
List<Field> fields = getSortedFields(instance);
Iterator<PrefixPropertySet> ppss = PropertySets.prefixPropertySets(properties, path).iterator();
PrefixPropertySet pps = null;
for (Field field : fields)
{
if (stored(field))
{
String name = fieldToPartName(field);
Path fieldPath = new Path.Builder(path).field(name).build();
// handle missing class fields by ignoring the properties
while (ppss.hasNext() && (pps == null || pps.getPrefix().compareTo(fieldPath) < 0))
{
pps = ppss.next();
}
// if there are no properties for the field we must still
// run a translator because some translators do not require
// any fields to set a field value e.g. KeyTranslator
Set<Property> childProperties;
if (pps == null || !fieldPath.equals(pps.getPrefix()))
{
// there were no properties for this field
childProperties = Collections.emptySet();
}
else
{
childProperties = pps.getProperties();
}
// get the correct translator for this field
PropertyTranslator translator = decoder(field, childProperties);