public Set entrySet() {
if (entrySet == null) {
entrySet = new LinkedHashSet<MapEntry>();
final ComplexType featureType = feature.getType();
PropertyDescriptor attributeDescr = featureType.getDescriptor(attributeName);
Property property = feature.getProperty(attributeName);
if (property == null) {
//maybe polymorphism? let's try
@SuppressWarnings("unchecked")
List<AttributeDescriptor> substitutionGroup = (List<AttributeDescriptor>) attributeDescr.getUserData().get("substitutionGroup");
if (substitutionGroup != null){
Iterator<AttributeDescriptor> it = substitutionGroup.iterator();
while (property==null && it.hasNext()) {
property = feature.getProperty(it.next().getName());
}
if (property!=null) {
attributeDescr = property.getDescriptor();
}
}
}
entrySet.add(new MapEntry<Object, Object>("isComplex", property instanceof ComplexAttribute));
Object value = null;
if (property instanceof ComplexAttribute) {
value = buildComplex((ComplexAttribute)property);
}
else if (property!=null) {
value = property.getValue();
}
entrySet.add(new DeferredValueEntry("value", value));
entrySet.add(new MapEntry<Object, Object>("name", attributeName.getLocalPart()));
entrySet.add(new MapEntry<Object, Object>("namespace", getNamespace(attributeName)));