/** * Builds the geometry attribute type. * * <p>This method resets all state after the attribute is built. */ public GeometryType buildGeometryType() { GeometryType type = factory.createGeometryType( name(), binding, crs, isIdentifiable, isAbstract, restrictions(), superType, description()); resetTypeState(); return type; }
private AttributeDescriptor buildSimpleDescriptor(Name name, Class binding) { AttributeTypeBuilder ab = new AttributeTypeBuilder(); ab.name(name.getLocalPart()).namespaceURI(name.getNamespaceURI()); ab.setBinding(binding); AttributeDescriptor descriptor = ab.buildDescriptor(name, ab.buildType()); return descriptor; }
private AttributeDescriptor buildFeatureDescriptor( Name name, SimpleFeatureType schema, int minOccurs, int maxOccurs) { AttributeTypeBuilder ab = new AttributeTypeBuilder(); ab.name(name.getLocalPart()).namespaceURI(name.getNamespaceURI()); ab.setMinOccurs(minOccurs); ab.setMaxOccurs(maxOccurs); AttributeDescriptor descriptor = ab.buildDescriptor(name, schema); return descriptor; }
/** * Builds the attribute type. * * <p>This method resets all state after the attribute is built. */ public AttributeType buildType() { if (length != null) { Filter lengthRestriction = lengthRestriction(length); restrictions().add(lengthRestriction); } AttributeType type = factory.createAttributeType( name(), binding, isIdentifiable, isAbstract, restrictions(), superType, description()); resetTypeState(); return type; }
ab.name(name).namespaceURI(namespaceURI).userData(SOURCE_ATTRIBUTE, ad.getLocalName()); AttributeDescriptor mappedDescriptor; if (ad instanceof GeometryDescriptor) {
public void testAttributeBuilder() { FilterFactory ff = CommonFactoryFinder.getFilterFactory(); AttributeTypeBuilder builder = new AttributeTypeBuilder(); builder.binding(Integer.class); builder.minOccurs(1).maxOccurs(1); builder.defaultValue(0); builder.name("percent").description("Percent between 0 and 100"); builder.restriction(ff.greaterOrEqual(ff.property("."), ff.literal(0))) .restriction(ff.lessOrEqual(ff.property("."), ff.literal(100))); final AttributeType PERCENT = builder.buildType(); builder.minOccurs(1).maxOccurs(1); builder.defaultValue(0); builder.name("percent").description("Percent between 0 and 100"); AttributeDescriptor a = builder.buildDescriptor("a", PERCENT); assertSame(a.getType(), PERCENT); assertEquals(a.getDefaultValue(), 0); Filter restrictions = ff.and(PERCENT.getRestrictions()); assertTrue(restrictions.evaluate(50)); assertFalse(restrictions.evaluate(150)); }
ab.name(name).namespaceURI(namespaceURI).userData(SOURCE_ATTRIBUTE, ad.getLocalName()); AttributeDescriptor mappedDescriptor; if (ad instanceof GeometryDescriptor) {
/** * Builds the geometry attribute type. * <p> * This method resets all state after the attribute is built. * </p> */ public GeometryType buildGeometryType() { GeometryType type = factory.createGeometryType( name(), binding, crs, isIdentifiable, isAbstract, restrictions(), superType, description()); resetTypeState(); return type; }
return new AttributeTypeBuilder().name(columnName).binding(type) .nillable(nillable).crs(crs).userData(Hints.COORDINATE_DIMENSION, dimension).buildDescriptor(columnName);
/** * Builds the attribute type. * <p> * This method resets all state after the attribute is built. * </p> */ public AttributeType buildType() { if(length != null){ Filter lengthRestriction = lengthRestriction(length); restrictions().add( lengthRestriction ); } AttributeType type = factory.createAttributeType( name(), binding, isIdentifiable, isAbstract, restrictions(), superType, description()); resetTypeState(); return type; }