Interface IField

    • Method Detail

      • getConstant

        Object getConstant()
                    throws JavaModelException
        Returns the constant value associated with this field or null if this field has none. To have a constant value, the field needs to be final and initialized with a compile-time constant expression.

        For types from source, this currently only works if the field initializer is a literal (returns null for more complex constant expressions).

        For primitive types, returns the boxed value.

        Returns:
        the constant value associated with this field, or null if not available
        Throws:
        JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
      • getElementName

        String getElementName()
        Returns the simple name of this field.
        Specified by:
        getElementName in interface IJavaElement
        Returns:
        the simple name of this field.
      • getKey

        String getKey()
        Returns the binding key for this field only if the given field is resolved. A binding key is a key that uniquely identifies this field. It allows access to generic info for parameterized fields.

        If the given field is not resolved, the returned key is simply the java element's key.

        Returns:
        the binding key for this field
        Since:
        3.1
        See Also:
        IBinding.getKey(), BindingKey, isResolved()
      • getTypeSignature

        String getTypeSignature()
                         throws JavaModelException
        Returns the type signature of this field. For enum constants, this returns the signature of the declaring enum class.

        The type signature may be either unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for parameterized types). See Signature for details.

        Returns:
        the type signature of this field
        Throws:
        JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
        See Also:
        Signature
      • isEnumConstant

        boolean isEnumConstant()
                        throws JavaModelException
        Returns whether this field represents an enum constant.
        Returns:
        whether this field represents an enum constant
        Throws:
        JavaModelException - if this element does not exist or if an exception occurs while accessing its corresponding resource
        Since:
        3.1
      • isResolved

        boolean isResolved()
        Returns whether this field represents a resolved field. If a field is resolved, its key contains resolved information.
        Returns:
        whether this field represents a resolved field.
        Since:
        3.1