/** * Specifies a number of attribute type bindings. * * @param schema The schema containing the attribute types. * @see {@link #addBinding(AttributeType)}. */ public void addBindings(Schema schema) { for (Iterator<AttributeType> itr = schema.values().iterator(); itr.hasNext(); ) { AttributeType type = itr.next(); addBinding(type); } }
/** * Load the indicated schema to map Java class to your Type System. (please us a profile to * prevent binding conflicts). * * @param schema */ public void load(Schema schema) { for (Iterator itr = schema.values().iterator(); itr.hasNext(); ) { AttributeType type = (AttributeType) itr.next(); addBinding(type.getBinding(), type); } }
AttributeType findType(Class binding) { for (Schema schema : typeMappingProfiles) { for (Map.Entry<Name, AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { return at; } } for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { return at; } } } return null; } }
/** * Specifies a number of attribute type bindings. * * @param schema The schema containing the attribute types. * * @see {@link #addBinding(AttributeType)}. */ public void addBindings( Schema schema ) { for (Iterator<AttributeType> itr = schema.values().iterator(); itr.hasNext();) { AttributeType type = itr.next(); addBinding(type); } }
/** * Load the indicated schema to map Java class to your Type System. (please us a profile to * prevent binding conflicts). * * @param schema */ public void load(Schema schema) { for (Iterator itr = schema.values().iterator(); itr.hasNext();) { AttributeType type = (AttributeType) itr.next(); addBinding(type.getBinding(), type); } }
AttributeType findType(Class binding) { for (Schema schema : typeMappingProfiles) { for (Map.Entry<Name,AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { return at; } } for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { return at; } } } return null; } }
Name findTypeName(Class binding) { for (Iterator p = profiles.iterator(); p.hasNext(); ) { Object profile = p.next(); Name name = null; if (profile instanceof TypeMappingProfile) { name = ((TypeMappingProfile) profile).name(binding); } else if (profile instanceof Schema) { Schema schema = (Schema) profile; for (Map.Entry<Name, AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { name = at.getName(); break; } } if (name == null) { for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { name = at.getName(); break; } } } } if (name != null) { return name; } } return null; }
protected Name lookupTypeName(List<Schema> profiles, Parameter arg) { // hack, look up for geometry mae if ("geometry".equals(arg.getName())) { return new NameImpl(org.geotools.gml3.v3_2.GML.AbstractGeometryType); } // default Class clazz = arg.getType(); if (clazz == null || clazz == Object.class) { return new NameImpl(XS.STRING); } // TODO: this is stolen from FeaturTypeSchemaBuilder, factor out into utility class for (Schema profile : profiles) { for (Map.Entry<Name, AttributeType> e : profile.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(clazz)) { return at.getName(); } } for (AttributeType at : profile.values()) { if (clazz.isAssignableFrom(at.getBinding())) { return at.getName(); } } } return new NameImpl(XS.STRING); } }