Exemplo n.º 1
0
  private AttributeDescriptor createAttributeDescriptor(
      AttributeType type,
      CoordinateReferenceSystem crs,
      Name elemName,
      int minOccurs,
      int maxOccurs,
      boolean nillable,
      Object defaultValue) {
    AttributeDescriptor descriptor = null;
    if (maxOccurs == -1) {
      // this happens when maxOccurs is set to "unbounded"
      maxOccurs = Integer.MAX_VALUE;
    }

    if (!(type instanceof AttributeTypeProxy)
        && Geometry.class.isAssignableFrom(type.getBinding())) {
      // create geometry descriptor with the simple feature type CRS
      GeometryType geomType =
          new GeometryTypeImpl(
              type.getName(),
              type.getBinding(),
              crs,
              type.isIdentified(),
              type.isAbstract(),
              type.getRestrictions(),
              type.getSuper(),
              type.getDescription());
      descriptor =
          typeFactory.createGeometryDescriptor(
              geomType, elemName, minOccurs, maxOccurs, nillable, defaultValue);
    } else {
      descriptor =
          typeFactory.createAttributeDescriptor(
              type, elemName, minOccurs, maxOccurs, nillable, defaultValue);
    }
    return descriptor;
  }