com.esri.arcgis.geodatabase
Interface IField

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
IField2, IFieldEdit, IFieldEdit2
All Known Implementing Classes:
Field, IField2Proxy, IFieldEdit2Proxy, IFieldEditProxy, IFieldProxy

public interface IField
extends java.io.Serializable

Provides access to members that return information about the field.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Description

The field object represents a column in a table. A field has many properties, the most obvious ones being its name and its datatype. The esriFieldType enumeration lists the possible datatypes.

Remarks

When you create a field of type esriFieldTypeSingle, esriFieldTypeDouble or esriFieldTypeInteger, and specify zero for precision and scale, the geodatabase will attempt to create a binary type field if the underlying database supports it. Personal geodatabases support only binary type fields.  ArcGIS ignores precision and scale of binary type fields.

Depending on the precision and scale setting you select, ArcGIS may convert the field into another type. For example:

 

The length property of a field has meaning only for esriFieldTypeString fields. The length property for all other field types is not important and will be ignored if specified.


Method Summary
 boolean checkValue(java.lang.Object value)
          Indicates if the value is valid given the field definition.
 java.lang.String getAliasName()
          The alias name of the field.
 java.lang.Object getDefaultValue()
          The default value of the field.
 IDomain getDomain()
          The default domain of the field.
 IGeometryDef getGeometryDef()
          The geometry definition for the field if IsGeometry is TRUE.
 int getLength()
          The maximum length, in bytes, for values described by the field.
 java.lang.String getName()
          The name of the field.
 int getPrecision()
          The precision for field values.
 int getScale()
          The scale for field values.
 int getType()
          The type of the field.
 int getVarType()
          The VARTYPE of the field (e.g.
 boolean isDomainFixed()
          Indicates if the field's domain is fixed.
 boolean isEditable()
          Indicates if the field is editable.
 boolean isNullable()
          Indicates if the field can contain null values.
 boolean isRequired()
          Indicates if the field is required.
 

Method Detail

getName

public java.lang.String getName()
                         throws java.io.IOException,
                                AutomationException
The name of the field.

Supported Platforms

Windows, Solaris, Linux

Remarks

Depending on the geometry type, there will be fields for shape length and shape area. In a personal geodatabase, these will be named Shape_Length and Shape_Area. In an SDE geodatabase, the names of these fields will be dependant on the underlying DBMS:

DB2 - SHAPE..Length() and SHAPE..Area()

Informix - SE_Length(shape) and SE_Area(shape)

Oracle - SHAPE.LEN and SHAPE.AREA

SQL Server - SHAPE.len and SHAPE.area

The IFeatureClass::ShapeFieldName property should be used to determine the name of the length and area fields for a feature class.

Returns:
The name
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAliasName

public java.lang.String getAliasName()
                              throws java.io.IOException,
                                     AutomationException
The alias name of the field.

Supported Platforms

Windows, Solaris, Linux

Remarks

This is only supported on fields from object classes and feature classes that are registered with the geodatabase; Personal, File or ArcSDE geodatabases.  For fields coming from other data sources (shapefiles, coverages, etc) the AliasName will be the same string as the field name.

Returns:
The name
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getType

public int getType()
            throws java.io.IOException,
                   AutomationException
The type of the field.

Supported Platforms

Windows, Solaris, Linux

Remarks

The following table outlines the equivalent field data types in ArcCatalog, ArcObjects, Visual Basic and a selection of DBMSs:

ArcCatalog

esriFieldType

(IField::Type)

VB Variable Type

(IField::VarType)

Access SQL Server Oracle
Short Integer esriFieldTypeSmallInteger vbInteger Number (Integer) smallint NUMBER
Long Integer esriFieldTypeInteger vbLong Number (Long Integer) int NUMBER
Float esriFieldTypeSingle vbSingle Number (Single) float NUMBER
Double esriFieldTypeDouble vbDouble Number (Double) float NUMBER
Text esriFieldTypeString vbString Text varchar VARCHAR2
Date esriFieldTypeDate vbDate Date/Time datetime DATE
Object ID esriFieldTypeOID vbLong AutoNumber (Long Integer) int NUMBER(38)
Geometry esriFieldTypeGeometry vbDataObject OLE Object int NUMBER(38) or SDO_GEOMETRY
Blob esriFieldTypeBlob vbObject OLE Object image NUMBER(38) or SDO_GEOMETRY
Raster esriFieldTypeRaster vbDataObject Number (Long Integer) int NUMBER
GUID esriFieldTypeGUID vbString Number (Replication ID) uniqueidentifier CHAR
GlobalID esriFieldTypeGlobalID vbString Number (Replication ID) uniqueidentifier CHAR

The following table outlines the Coverage, INFO Item to Geodatabase field mapping:

Item type Item width Geodatabase field type (esriFieldType)
B 4 esriFieldTypeInteger
C 1-320 esriFieldTypeString
D 8 esriFieldTypeDate
F 4 esriFieldTypeSingle
F 8 esriFieldTypeDouble
I 1-4 esriFieldTypeSmallInteger
I 5-9 esriFieldTypeInteger
I 10-16 esriFieldTypeDouble
N 1-9 esriFieldTypeSingle
N 10-16 esriFieldTypeDouble

The following table outlines the Shapefile, dBASE field to Geodatabase field mapping:

Field type Field width Geodatabase field type (esriFieldType)
Date - esriFieldTypeDate
String 1-255 esriFieldTypeString
Boolean - esriFieldTypeString
Number 1-16 (decimals = 0) esriFieldTypeInteger
Number 1-16 (decimals > 0) esriFieldTypeDouble

Returns:
A com.esri.arcgis.geodatabase.esriFieldType constant
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDomain

public IDomain getDomain()
                  throws java.io.IOException,
                         AutomationException
The default domain of the field.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.geodatabase.IDomain
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IDomain

getDefaultValue

public java.lang.Object getDefaultValue()
                                 throws java.io.IOException,
                                        AutomationException
The default value of the field.

Supported Platforms

Windows, Solaris, Linux

Returns:
A Variant
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLength

public int getLength()
              throws java.io.IOException,
                     AutomationException
The maximum length, in bytes, for values described by the field.

Supported Platforms

Windows, Solaris, Linux

Returns:
The length
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getPrecision

public int getPrecision()
                 throws java.io.IOException,
                        AutomationException
The precision for field values.

Supported Platforms

Windows, Solaris, Linux

Remarks

Precision is the number of digits in a number. For example, the number 56.78 has a precision of 4. Precision is only valid for fields that are numeric. Precision is always returned as 0 from personal or File geodatabase fields.

Returns:
The length
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getScale

public int getScale()
             throws java.io.IOException,
                    AutomationException
The scale for field values.

Supported Platforms

Windows, Solaris, Linux

Remarks

Scale is the number of digits to the right of the decimal point in a number. For example, the number 56.78 has a scale of 2. Scale applies only to fields that are double.  Scale is always returned as 0 from personal or File geodatabase fields.

Returns:
The length
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isNullable

public boolean isNullable()
                   throws java.io.IOException,
                          AutomationException
Indicates if the field can contain null values.

Returns:
The isNullable
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getGeometryDef

public IGeometryDef getGeometryDef()
                            throws java.io.IOException,
                                   AutomationException
The geometry definition for the field if IsGeometry is TRUE.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.geodatabase.IGeometryDef
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IGeometryDef

getVarType

public int getVarType()
               throws java.io.IOException,
                      AutomationException
The VARTYPE of the field (e.g. VT_I4).

Supported Platforms

Windows, Solaris, Linux

Description

Returns an Integer indicating the subtype of a variable.

Remarks

The following is a list of the Vartype constants
Constant Value Description

vbEmpty

vbNull

vbInteger

vbLong

vbSingle

vbDouble

vbCurrency

vbDate

vbString

vbObject

vbError

vbBoolean

vbVariant

vbDataObject

vbDecimal

vbByte

vbArray

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

17

8192

Uninitialized (default)

Contains no valid data

Integer subtype

Long subtype

Single subtype

Double subtype

Currency subtype

Date subtype

String subtype

Object

Error subtype

Boolean subtype

Variant (used only for arrays of variants)

Data access object

Decimal subtype

Byte subtype

Array

Returns:
The varType
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDomainFixed

public boolean isDomainFixed()
                      throws java.io.IOException,
                             AutomationException
Indicates if the field's domain is fixed.

Supported Platforms

Windows, Solaris, Linux

Returns:
The isFixed
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IDomain

isRequired

public boolean isRequired()
                   throws java.io.IOException,
                          AutomationException
Indicates if the field is required.

Supported Platforms

Windows, Solaris, Linux

Description

All tables and feature classes have a set of required fields that are necessary to record the state of any particular object in the table or feature class. These required fields are automatically created when you create a new feature class or table, and cannot be deleted. Required fields may also have required properties such as its domain property. You cannot modify the required property of a required field.

For example, in a simple feature class, OID and Shape are required fields. They do have properties such as their alias and geometry type that you can modify, but these fields cannot be deleted.

Returns:
The isRequired
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEditable

public boolean isEditable()
                   throws java.io.IOException,
                          AutomationException
Indicates if the field is editable.

Supported Platforms

Windows, Solaris, Linux

Remarks

It is best to loop through the fields of a feature and skip the fields that are not editable, rather than allowing users to attempt to edit fields that cannot be edited.

Returns:
The isEditable
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

checkValue

public boolean checkValue(java.lang.Object value)
                   throws java.io.IOException,
                          AutomationException
Indicates if the value is valid given the field definition.

Supported Platforms

Windows, Solaris, Linux

Description

CheckValue tests whether the specified value is valid for the current field, based upon the field type.  For example, CheckValue will verify if the supplied value corresponds to field type of Small Integer or if the value corresponds to a string value.

The value is not checked against any existing domain.

Parameters:
value - A Variant (in)
Returns:
The isValidValue
Throws:
java.io.IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.