本文整理汇总了Java中org.opengis.feature.type.AttributeDescriptor.isNillable方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeDescriptor.isNillable方法的具体用法?Java AttributeDescriptor.isNillable怎么用?Java AttributeDescriptor.isNillable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.feature.type.AttributeDescriptor
的用法示例。
在下文中一共展示了AttributeDescriptor.isNillable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import org.opengis.feature.type.AttributeDescriptor; //导入方法依赖的package包/类
/**
* Read attribute in position marked by <code>index</code>.
*
* @param index Attribute position to read
* @return Value for the attribtue in position <code>index</code>
* @throws IOException
* @throws ArrayIndexOutOfBoundsException
*/
public Object read(int index) throws IOException,
ArrayIndexOutOfBoundsException {
if (line == null) {
throw new IOException(
"No content available - did you remeber to call next?");
}
AttributeDescriptor attType = type.getDescriptor(index);
String stringValue = null;
try {
// read the value
stringValue = text[index];
// trim off any whitespace
if (stringValue != null) {
stringValue = stringValue.trim();
}
if ("".equals(stringValue)) {
stringValue = null;
}
} catch (RuntimeException e1) {
e1.printStackTrace();
stringValue = null;
}
// check for special <null> flag
if ("<null>".equals(stringValue)) {
stringValue = null;
}
if (stringValue == null) {
if (attType.isNillable()) {
return null;
}
}
// Use of Converters to convert from String to requested java binding
Object value = Converters.convert(stringValue, attType.getType()
.getBinding());
if (attType.getType() instanceof GeometryType) {
// this is to be passed on in the geometry objects so the srs name
// gets encoded
CoordinateReferenceSystem crs = ((GeometryType) attType.getType())
.getCoordinateReferenceSystem();
if (crs != null) {
// must be geometry, but check anyway
if (value != null && value instanceof Geometry) {
((Geometry) value).setUserData(crs);
}
}
}
return value;
}