public AttributeType getXmlAttributeType() { if (XMLATTRIBUTE_TYPE == null) { XMLATTRIBUTE_TYPE = typeFactory.createAttributeType( new NameImpl(null, "@attribute"), String.class, false, false, Collections.<Filter>emptyList(), null, null); } return XMLATTRIBUTE_TYPE; } }
protected AttributeType createType( XSDSimpleTypeDefinition xsdType, int depth ) { if (types.containsKey(xsdType)) { return (AttributeType) types.get(xsdType); } //import? if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return (AttributeType) findType(xsdType); } //first build super type AttributeType superType = null; XSDTypeDefinition baseType = xsdType.getBaseType(); if ((baseType != null) && !baseType.equals(xsdType)) { if (baseType.getName() != null) { //ignore unamed types //superType = createType((XSDSimpleTypeDefinition)baseType); superType = createType(baseType, depth+1); assert superType != null; } } //TODO: actually derive valus from type AttributeType gtType = factory.createAttributeType( name(xsdType), Object.class, false, false, Collections.EMPTY_LIST, superType, null ); types.put(xsdType, gtType); return gtType; }
/** * 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; }
InternationalString description = null; attType = typeFactory.createAttributeType( assignedName, binding,
factory.createAttributeType( typeName(), getBinding(),
public AttributeType getXmlAttributeType() { if (XMLATTRIBUTE_TYPE == null) { XMLATTRIBUTE_TYPE = typeFactory.createAttributeType( new NameImpl(null, "@attribute"), String.class, false, false, Collections.<Filter>emptyList(), null, null); } return XMLATTRIBUTE_TYPE; } }
(GeometryType) attributeType, name, min, max, nillable, defaultValue); } else { attributeType = typeFactory.createAttributeType(name, type, isIdentifiable, isAbstract, restrictions, superType, description); attributeDescriptor = typeFactory.createAttributeDescriptor(attributeType, name,
(GeometryType) attributeType, name, min, max, nillable, defaultValue); } else { attributeType = typeFactory.createAttributeType(name, type, isIdentifiable, isAbstract, restrictions, superType, description); attributeDescriptor = typeFactory.createAttributeDescriptor(attributeType, name,
private static AttributeType readAttributeType(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final byte typeTag = in.readByte(); final FieldType type = FieldType.valueOf(typeTag); if (Geometry.class.isAssignableFrom(type.getBinding())) { final boolean isCRSCode = in.readBoolean(); // as opposed to a raw WKT string final String crsText = in.readUTF(); final CoordinateReferenceSystem crs; try { if (isCRSCode) { if (RevObjects.NULL_CRS_IDENTIFIER.equals(crsText)) { crs = null; } else { boolean forceLongitudeFirst = crsText.startsWith("EPSG:"); crs = CRS.decode(crsText, forceLongitudeFirst); } } else { crs = CRS.parseWKT(crsText); } } catch (FactoryException e) { throw new RuntimeException(e); } return typeFactory.createGeometryType(name, type.getBinding(), crs, false, false, Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null); } }
Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null);
private static AttributeType readAttributeType(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final byte typeTag = in.readByte(); final FieldType type = FieldType.valueOf(typeTag); if (Geometry.class.isAssignableFrom(type.getBinding())) { final boolean isCRSCode = in.readBoolean(); // as opposed to a raw WKT string final String crsText = in.readUTF(); final CoordinateReferenceSystem crs; try { if (isCRSCode) { if (RevObjects.NULL_CRS_IDENTIFIER.equals(crsText)) { crs = null; } else { boolean forceLongitudeFirst = crsText.startsWith("EPSG:"); crs = CRS.decode(crsText, forceLongitudeFirst); } } else { crs = CRS.parseWKT(crsText); } } catch (FactoryException e) { throw new RuntimeException(e); } return typeFactory.createGeometryType(name, type.getBinding(), crs, false, false, Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null); } }
private static AttributeType readAttributeType(DataInput in, FeatureTypeFactory typeFactory) throws IOException { final Name name = readName(in); final byte typeTag = in.readByte(); final FieldType type = FieldType.valueOf(typeTag); if (Geometry.class.isAssignableFrom(type.getBinding())) { final boolean isCRSCode = in.readBoolean(); // as opposed to a raw WKT string final String crsText = in.readUTF(); final CoordinateReferenceSystem crs; try { if (isCRSCode) { if ("urn:ogc:def:crs:EPSG::0".equals(crsText)) { crs = null; } else { boolean forceLongitudeFirst = crsText.startsWith("EPSG:"); crs = CRS.decode(crsText, forceLongitudeFirst); } } else { crs = CRS.parseWKT(crsText); } } catch (FactoryException e) { throw new RuntimeException(e); } return typeFactory.createGeometryType(name, type.getBinding(), crs, false, false, Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null); } }
Collections.<Filter> emptyList(), null, null); } else { return typeFactory.createAttributeType(name, type.getBinding(), false, false, Collections.<Filter> emptyList(), null, null);
/** * 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; }
.createAttributeType(attribute.getType().getName(), String.class, false, false, null, null, null); AttributeDescriptor descriptor = builder.getFeatureTypeFactory()
/** * Creation method for AttributeType. * <p> * Example: * * <pre><code> * AttributeType TEXT = builder.name("Text").bind(String.class).attribute(); * </code></pre> * * </p> * <p> * Example: * * <pre><code> * builder.setName("Interger"); * builder.setBinding(Integer.class); * AttributeType INTEGER = builder.attribute(); * </code></pre> * * </p> * * @return AttributeType created */ public AttributeType attribute() { AttributeType type = factory.createAttributeType(typeName(), getBinding(), isIdentified(), isAbstract(), restrictions(), getSuper(), getDescription()); reset(); return type; }
descriptorName, minOccurs, maxOccurs, nillable, defaultValue); } else { AttributeType attributeType = ftfactory.createAttributeType(attributeTypeName, binding, type.identified(), false, null, null, null); Object defaultValue = null;
public @Test final void createFeatureTypeNillability() { FeatureTypeFactory ftf = CommonFactoryFinder.getFeatureTypeFactory(null); Name attName1 = new NameImpl("int_Type"); Name attName2 = new NameImpl("string_Type"); Class<?> binding = Integer.class; boolean isIdentifiable = false; boolean isAbstract = false; List<Filter> restrictions = null; AttributeType superType = null; InternationalString description = null; AttributeType attribute1 = ftf.createAttributeType(attName1, binding, isIdentifiable, isAbstract, restrictions, superType, description); AttributeType attribute2 = ftf.createAttributeType(attName2, binding, isIdentifiable, isAbstract, restrictions, superType, description); int minOccurs = 0; int maxOccurs = 1; boolean isNillable = true; Object defaultValue = null; AttributeDescriptor descriptor1 = ftf.createAttributeDescriptor(attribute1, attribute1.getName(), minOccurs, maxOccurs, isNillable, defaultValue); isNillable = false; AttributeDescriptor descriptor2 = ftf.createAttributeDescriptor(attribute2, attribute2.getName(), minOccurs, maxOccurs, isNillable, defaultValue); SimpleFeatureTypeBuilder sftb = new SimpleFeatureTypeBuilder(ftf); sftb.add(descriptor1); sftb.add(descriptor2); sftb.setName(new NameImpl("SimpleName")); SimpleFeatureType featureType = sftb.buildFeatureType(); testCreateFeatureType(id1, featureType); }
AttributeType superType = null; InternationalString description = null; AttributeType attribute1 = ftf.createAttributeType(attName1, binding, isIdentifiable, isAbstract, restrictions, superType, description); AttributeType attribute2 = ftf.createAttributeType(attName2, binding, isIdentifiable, isAbstract, restrictions, superType, description);
AttributeType superType = null; InternationalString description = null; AttributeType attribute1 = ftf.createAttributeType(attName1, binding, isIdentifiable, isAbstract, restrictions, superType, description); AttributeType attribute2 = ftf.createAttributeType(attName2, binding, isIdentifiable, isAbstract, restrictions, superType, description);