Search in sources :

Example 6 with ScopedName

use of org.opengis.util.ScopedName in project sis by apache.

the class AbstractFeature method propertyNotFound.

/**
 * Returns the exception message for a property not found. The message will differ depending
 * on whether the property is not found because ambiguous or because it does not exist.
 *
 * @param  feature   the name of the feature where a property where searched ({@link String} or {@link GenericName}).
 * @param  property  the name of the property which has not been found.
 */
static String propertyNotFound(final FeatureType type, final Object feature, final String property) {
    GenericName ambiguous = null;
    for (final AbstractIdentifiedType p : type.getProperties(true)) {
        final GenericName next = p.getName();
        GenericName name = next;
        do {
            if (property.equalsIgnoreCase(name.toString())) {
                if (ambiguous == null) {
                    ambiguous = next;
                } else {
                    return Errors.format(Errors.Keys.AmbiguousName_3, ambiguous, next, property);
                }
            }
        } while (name instanceof ScopedName && (name = ((ScopedName) name).tail()) != null);
    }
    return Resources.format(Resources.Keys.PropertyNotFound_2, feature, property);
}
Also used : GenericName(org.opengis.util.GenericName) ScopedName(org.opengis.util.ScopedName)

Aggregations

ScopedName (org.opengis.util.ScopedName)6 GenericName (org.opengis.util.GenericName)5 LocalName (org.opengis.util.LocalName)2 IdentityHashMap (java.util.IdentityHashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 XmlElementRef (javax.xml.bind.annotation.XmlElementRef)1 DependsOnMethod (org.apache.sis.test.DependsOnMethod)1 DefaultLocalName (org.apache.sis.util.iso.DefaultLocalName)1 DefaultMemberName (org.apache.sis.util.iso.DefaultMemberName)1 DefaultTypeName (org.apache.sis.util.iso.DefaultTypeName)1 Test (org.junit.Test)1 InternationalString (org.opengis.util.InternationalString)1 MemberName (org.opengis.util.MemberName)1 TypeName (org.opengis.util.TypeName)1