Interface JCoMetaData

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
JCoClassMetaData, JCoListMetaData, JCoRecordMetaData

public interface JCoMetaData extends Serializable, Cloneable
Encapsulates the metadata of JCo data containers. Each element of metadata describes a field of these data containers in terms of name, type, length, etc. JCoMetadata is the basis for the two important metadata interfaces of JCo, and includes their common functionality: JCoListMetaData and JCoRecordMetaData.
Moreover, it contains constants for all supported data types, where each JCo data type corresponds to one of the built-in types of ABAP.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    ABAP object.
    static final int
    Packed BCD number, any length between 1 and 16 bytes.
    static final int
    ABAP boxed component.
    static final int
    Raw data, binary, fixed length, zero padded.
    static final int
    Date representing a month and a day of the month without specifying a year.
    static final int
    1-byte or multi-byte character.Fixed sized, blank padded.
    static final int
    Date ( YYYYYMMDD ).
    static final int
    Decimal floating point.
    static final int
    Decimal floating point.
    static final int
    Date representing year, month, and day.
    static final int
    Date representing a year and a month.
    static final int
    Date representing a year and a week of the year.
    static final int
    ABAP exception.
    static final int
    Floating point,double precision.
    static final int
    ABAP boxed generic component.
    static final int
    4-byte integer.
    static final int
    1-byte integer.
    static final int
    2-byte integer.
    static final int
    8-byte integer, corresponds to ABAP type '8'.
    static final int
    The field info does not contain a valid JCO type.
    static final int
    Internal table.
    static final int
    Digits, fixed size,'0' padded.
    static final int
    UTF8 encoded string of variable length.
    static final int
    A heterogeneous structure.
    static final int
    A JCoTable.
    static final int
    Time (HHMMSS).
    static final int
    Time representing hours and minutes.
    static final int
    Time representing hours, minutes, and seconds.
    static final int
    Timestamp with high precision.
    static final int
    Timestamp with a precision of one minute.
    static final int
    Timestamp with a precision of one second.
    static final int
    Byte array of variable length.
    static final int
    The field info was not initialized yet.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getByteLength(int index)
    Returns the byte length of the data field for non-Unicode layout at the specified index.
    int
    getByteLength(String fieldName)
    Returns the byte length of the field for non-Unicode layout with the specified name.
    getClassMetaData(int index)
    Returns the metadata object for the field, if the specified field is an ABAP object and was defined with a reference to a metadata object.
    Returns the metadata object for the field, if the specified field is a ABAP object and was defined with a reference to a metadata object.
    Returns the fully-qualified name of the Java class whose instances are manufactured, if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.
    Returns the fully-qualified name of the Java class whose instances are manufactured, if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.
    int
    getDecimals(int index)
    Returns the number of decimals of the data field at the specified index.
    int
    getDecimals(String fieldName)
    Returns the number of decimals for the field with the specified name Decimals are only necessary for the JCO data types TYPE_BCD and TYPE_FLOAT, respectively.
    getDescription(int index)
    Returns the descriptive text of the data field at the specified index.
    Returns the descriptive text for the field with the specified name.
    Returns the extended field metadata object at the specified index.
    Returns the extended metadata object for the field with the specified name.
    int
    Returns the number of entries (fields).
    int
    getLength(int index)
    Returns the max length of the data field at the specified index.
    int
    getLength(String fieldName)
    Returns the max length of the data field at the specified index.
    Returns the name of the table/structure this metadata describes.
    getName(int index)
    Returns the field name of the data field at the specified index.
    getRecordMetaData(int index)
    Returns the metadata object for the field, if the specified field is a table or structure and was defined with a reference to a metadata object.
    Returns the metadata object for the field, if the specified field is a table or structure and was defined with a reference to a metadata object.
    getRecordTypeName(int index)
    Returns the table/structure name of the data field or null if no table name is available.
    Returns the table/structure or data element name of the data field or null if no table name or data element name is available.
    int
    getType(int index)
    Returns the JCo data type of the data field at the specified index.
    int
    getType(String fieldName)
    Returns the JCo data type of the data for the field with the specified name.
    getTypeAsString(int index)
    Returns a String representation of the JCo data type of the data field at the specified index.
    Returns a String representation of the JCo data type of the data field for the field with the specified name.
    int
    Returns the length of the data field at the specified index for Unicode layout.
    int
    Returns the length of the field with the specified name for Unicode layout.
    boolean
    hasField(String fieldName)
    Checks whether a named field exists.
    int
    indexOf(String fieldName)
    Returns the index of the named field info.
    boolean
    isAbapObject(int index)
    Checks whether the field with the specified index is an ABAP object.
    boolean
    isAbapObject(String fieldName)
    Checks whether the field with the specified name is an ABAP object.
    boolean
    Returns whether this metadata instance is locked.
    boolean
    Checks whether the field at the specified index is a nested TYPE1 structure, which is a structure with a fixed length in memory, but with a nested layout.
    boolean
    Checks whether the field with the specified name is a nested TYPE1 structure, which is a structure with a fixed length in memory, but with a nested layout.
    boolean
    isStructure(int index)
    Checks whether the field at the specified index is a structure parameter.
    boolean
    isStructure(String fieldName)
    Checks whether the field with the specified name is a structure parameter.
    boolean
    isTable(int index)
    Checks whether the field is a table parameter.
    boolean
    isTable(String fieldName)
    Checks whether the field with the specified name is a table parameter.
    void
    Locks the metadata to prevent further changes.
    void
    Sets the name of the table/structure this metadata describes.
  • Field Details

    • UNINITIALIZED

      static final int UNINITIALIZED
      The field info was not initialized yet.
      See Also:
    • TYPE_INVALID

      static final int TYPE_INVALID
      The field info does not contain a valid JCO type.
      See Also:
    • TYPE_CHAR

      static final int TYPE_CHAR
      1-byte or multi-byte character.Fixed sized, blank padded. Corresponds to ABAP type 'C'.
      See Also:
    • TYPE_DATE

      static final int TYPE_DATE
      Date ( YYYYYMMDD ). Corresponds to ABAP type 'D'.
      See Also:
    • TYPE_BCD

      static final int TYPE_BCD
      Packed BCD number, any length between 1 and 16 bytes. Corresponds to ABAP type 'P'.
      See Also:
    • TYPE_TIME

      static final int TYPE_TIME
      Time (HHMMSS). Corresponds to ABAP type 'T'.
      See Also:
    • TYPE_BYTE

      static final int TYPE_BYTE
      Raw data, binary, fixed length, zero padded. Corresponds to ABAP type 'X'.
      See Also:
    • TYPE_ITAB

      static final int TYPE_ITAB
      Internal table. (Deprecated! Not used)
      See Also:
    • TYPE_NUM

      static final int TYPE_NUM
      Digits, fixed size,'0' padded. Corresponds to ABAP type 'N'.
      See Also:
    • TYPE_FLOAT

      static final int TYPE_FLOAT
      Floating point,double precision. Corresponds to ABAP type 'F'.
      See Also:
    • TYPE_INT

      static final int TYPE_INT
      4-byte integer. Corresponds to ABAP type 'I'.
      See Also:
    • TYPE_INT2

      static final int TYPE_INT2
      2-byte integer. Corresponds to ABAP type 's'.
      See Also:
    • TYPE_INT1

      static final int TYPE_INT1
      1-byte integer. Corresponds to ABAP type 'b'.
      See Also:
    • TYPE_STRUCTURE

      static final int TYPE_STRUCTURE
      A heterogeneous structure. Corresponds to ABAP type 'u' and 'v'.
      See Also:
    • TYPE_DECF16

      static final int TYPE_DECF16
      Decimal floating point. Corresponds to ABAP type 'a'.
      See Also:
    • TYPE_DECF34

      static final int TYPE_DECF34
      Decimal floating point. Corresponds to ABAP type 'e'.
      See Also:
    • TYPE_STRING

      static final int TYPE_STRING
      UTF8 encoded string of variable length. Corresponds to ABAP type 'g'.
      See Also:
    • TYPE_XSTRING

      static final int TYPE_XSTRING
      Byte array of variable length. Corresponds to ABAP type 'y'.
      See Also:
    • TYPE_INT8

      static final int TYPE_INT8
      8-byte integer, corresponds to ABAP type '8'.
      See Also:
    • TYPE_UTCLONG

      static final int TYPE_UTCLONG
      Timestamp with high precision. Date and time including fractions of a second. Corresponds to ABAP type 'p'.
      See Also:
    • TYPE_UTCSECOND

      static final int TYPE_UTCSECOND
      Timestamp with a precision of one second. Date and time with hours, minutes, and seconds. Corresponds to ABAP type 'n'.
      See Also:
    • TYPE_UTCMINUTE

      static final int TYPE_UTCMINUTE
      Timestamp with a precision of one minute. Date and time with hours and minutes. Corresponds to ABAP type 'w'.
      See Also:
    • TYPE_DTDAY

      static final int TYPE_DTDAY
      Date representing year, month, and day. Corresponds to ABAP type 'd'.
      See Also:
    • TYPE_DTWEEK

      static final int TYPE_DTWEEK
      Date representing a year and a week of the year. Corresponds to ABAP type '7'.
      See Also:
    • TYPE_DTMONTH

      static final int TYPE_DTMONTH
      Date representing a year and a month. Corresponds to ABAP type 'x'.
      See Also:
    • TYPE_TSECOND

      static final int TYPE_TSECOND
      Time representing hours, minutes, and seconds. Corresponds to ABAP type 't'.
      See Also:
    • TYPE_TMINUTE

      static final int TYPE_TMINUTE
      Time representing hours and minutes. Corresponds to ABAP type 'i'.
      See Also:
    • TYPE_CDAY

      static final int TYPE_CDAY
      Date representing a month and a day of the month without specifying a year. Corresponds to ABAP type 'c'.
      See Also:
    • TYPE_TABLE

      static final int TYPE_TABLE
      A JCoTable. Corresponds to ABAP type 'h'.
      See Also:
    • TYPE_EXCEPTION

      static final int TYPE_EXCEPTION
      ABAP exception. Corresponds to ABAP type 'E'.
      See Also:
    • TYPE_ABAPOBJECT

      static final int TYPE_ABAPOBJECT
      ABAP object. Corresponds to ABAP type '*' and '+'.
      See Also:
    • TYPE_BOX

      static final int TYPE_BOX
      ABAP boxed component. Corresponds to ABAP type 'j'.
      See Also:
    • TYPE_GENERIC_BOX

      static final int TYPE_GENERIC_BOX
      ABAP boxed generic component. Corresponds to ABAP type 'k'.
      See Also:
  • Method Details

    • indexOf

      int indexOf(String fieldName)
      Returns the index of the named field info.
      Parameters:
      fieldName - the name of the field for which the index is being returned
      Returns:
      the index of the named field in the fields list
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • hasField

      boolean hasField(String fieldName)
      Checks whether a named field exists.
      Parameters:
      fieldName - the name of the field to check for existence
      Returns:
      true if the field with the specified name exist, false otherwise
    • getName

      String getName()
      Returns the name of the table/structure this metadata describes.
      Returns:
      The name of the underlying table/structure
    • setName

      void setName(String name)
      Sets the name of the table/structure this metadata describes. This is in particular useful, when creating a similar instance from an existing metadata instance.
      Parameters:
      name - the name for the record metadata
      Since:
      JCo 3.0.7
    • getFieldCount

      int getFieldCount()
      Returns the number of entries (fields).
      Returns:
      the number of entries
    • getName

      String getName(int index)
      Returns the field name of the data field at the specified index. The field name is used for identifying a field in a structure or table row.
      Parameters:
      index - the index of the field
      Returns:
      The field name of the data field described by this meta information object.
    • getRecordTypeName

      String getRecordTypeName(int index)
      Returns the table/structure name of the data field or null if no table name is available.
      Parameters:
      index - the index of the field
      Returns:
      The table/structure name of the data field described by this meta information object.
    • getRecordTypeName

      String getRecordTypeName(String fieldName)
      Returns the table/structure or data element name of the data field or null if no table name or data element name is available.
      Parameters:
      fieldName - the name of the field
      Returns:
      The table/structure name of the data field described by this meta information object.
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getRecordMetaData

      JCoRecordMetaData getRecordMetaData(int index)
      Returns the metadata object for the field, if the specified field is a table or structure and was defined with a reference to a metadata object.
      The method will return null if no metadata is available. This is the case if the definition was done with type name or the metadata object was not obtained from repository.

      Note: To get the proper metadata object for the field it is possible to call

           JCoRepository repository;
           ...
           repository.getRecordMetaData(metaDataInstance.getRecordTypeName(index));
       
      Parameters:
      index - the index of the field
      Returns:
      The table/structure metadata of the data field or null
      See Also:
    • getRecordMetaData

      JCoRecordMetaData getRecordMetaData(String fieldName)
      Returns the metadata object for the field, if the specified field is a table or structure and was defined with a reference to a metadata object.
      The method will return null if no metadata are available. This is the case if the definition was done with type name or the metadata object was not obtained from repository.

      Note: To get the proper metadata object for the field it is possible to call

           JCoRepository repository;
           ...
           repository.getRecordMetaData(metaDataInstance.getRecordTypeName(fieldName));
       
      Parameters:
      fieldName - the name of the field
      Returns:
      The table/structure metadata of the data field or null
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
      See Also:
    • getClassMetaData

      JCoClassMetaData getClassMetaData(int index)
      Returns the metadata object for the field, if the specified field is an ABAP object and was defined with a reference to a metadata object.
      The method will return null if no metadata is available. This is the case if the definition was done with type name or the metadata object was not obtained from repository.

      Note: To get the proper metadata object for the field it is possible to call JCoRepository.getClassMetaData(String).

      Parameters:
      index - the index of the field
      Returns:
      The class/interface metadata of the data field or null
      Since:
      JCo 3.1.0
    • getClassMetaData

      JCoClassMetaData getClassMetaData(String fieldName)
      Returns the metadata object for the field, if the specified field is a ABAP object and was defined with a reference to a metadata object.
      The method will return null if no metadata is available. This is the case if the definition was done with type name or the metadata object was not obtained from repository.

      Note: To get the proper metadata object for the field it is possible to call JCoRepository.getClassMetaData(String).

      Parameters:
      fieldName - the name of the field
      Returns:
      the class/interface metadata of the data field or null
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
      Since:
      JCo 3.1.0
    • getExtendedFieldMetaData

      JCoExtendedFieldMetaData getExtendedFieldMetaData(int index)
      Returns the extended field metadata object at the specified index.
      Parameters:
      index - the index of the field
      Returns:
      the extended field metadata object or null if not available
    • getExtendedFieldMetaData

      JCoExtendedFieldMetaData getExtendedFieldMetaData(String fieldName)
      Returns the extended metadata object for the field with the specified name.
      Parameters:
      fieldName - the name of the field
      Returns:
      the extended field metadata object or null if not available
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getUnicodeByteLength

      int getUnicodeByteLength(int index)
      Returns the length of the data field at the specified index for Unicode layout.
      Parameters:
      index - the index of the field
      Returns:
      data field length for Unicode layout
    • getUnicodeByteLength

      int getUnicodeByteLength(String fieldName)
      Returns the length of the field with the specified name for Unicode layout.
      Parameters:
      fieldName - the name of the field
      Returns:
      data field length for Unicode layout
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getByteLength

      int getByteLength(int index)
      Returns the byte length of the data field for non-Unicode layout at the specified index.
      Parameters:
      index - the index of the field
      Returns:
      data field length for non-Unicode layout
    • getByteLength

      int getByteLength(String fieldName)
      Returns the byte length of the field for non-Unicode layout with the specified name.
      Parameters:
      fieldName - the name of the field
      Returns:
      data field length for non-Unicode layout
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getLength

      int getLength(int index)
      Returns the max length of the data field at the specified index.
      • for the character based types the char length will be returned.
      • for type STRING or XSTRING 0
      • for type STRUCTURE or TABLE 0
      • for numerical types the byte length will be returned
      Note: in case of deep metadata the length for tables and structures can only be requested by their metadata directly.
      Parameters:
      index - the index of the field
      Returns:
      data field length
    • getLength

      int getLength(String fieldName)
      Returns the max length of the data field at the specified index.
      Parameters:
      fieldName - the name of the field
      Returns:
      data field length
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getType

      int getType(int index)
      Returns the JCo data type of the data field at the specified index.
      Parameters:
      index - the index of the field
      Returns:
      the JCo data type
    • getType

      int getType(String fieldName)
      Returns the JCo data type of the data for the field with the specified name.
      Parameters:
      fieldName - the name of the field
      Returns:
      the JCo data type
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getTypeAsString

      String getTypeAsString(int index)
      Returns a String representation of the JCo data type of the data field at the specified index.
      Parameters:
      index - the index of the field
      Returns:
      a String description of the JCo data type
    • getTypeAsString

      String getTypeAsString(String fieldName)
      Returns a String representation of the JCo data type of the data field for the field with the specified name.
      Parameters:
      fieldName - the name of the field
      Returns:
      a String description of the JCo data type
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getClassNameOfField

      String getClassNameOfField(String fieldName)
      Returns the fully-qualified name of the Java class whose instances are manufactured, if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.
      Parameters:
      fieldName - the name of the field
      Returns:
      the fully-qualified class name of the value object
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getClassNameOfField

      String getClassNameOfField(int index)
      Returns the fully-qualified name of the Java class whose instances are manufactured, if the methods getValue(int index) or getValue(String fieldName) are called to retrieve a value from the field.
      Parameters:
      index - the field index
      Returns:
      the fully-qualified class name of the value object
    • getDecimals

      int getDecimals(int index)
      Returns the number of decimals of the data field at the specified index. Decimals are only necessary for the JCO data types TYPE_BCD and TYPE_FLOAT, respectively.
      Parameters:
      index - the index of the field
      Returns:
      data field number of decimals.
    • getDecimals

      int getDecimals(String fieldName)
      Returns the number of decimals for the field with the specified name Decimals are only necessary for the JCO data types TYPE_BCD and TYPE_FLOAT, respectively.
      Parameters:
      fieldName - the name of the field
      Returns:
      data field number of decimals.
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • getDescription

      String getDescription(int index)
      Returns the descriptive text of the data field at the specified index.
      Parameters:
      index - the index of the field
      Returns:
      A descriptive text of the data field
    • getDescription

      String getDescription(String fieldName)
      Returns the descriptive text for the field with the specified name.
      Parameters:
      fieldName - the name of the field
      Returns:
      A descriptive text of the data field
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • isStructure

      boolean isStructure(int index)
      Checks whether the field at the specified index is a structure parameter.
      Parameters:
      index - the index of the field
      Returns:
      true if the specified field is a structure parameter, false otherwise
    • isStructure

      boolean isStructure(String fieldName)
      Checks whether the field with the specified name is a structure parameter.
      Parameters:
      fieldName - the name of the field
      Returns:
      true if the specified field is a structure parameter, false otherwise
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • isNestedType1Structure

      boolean isNestedType1Structure(int index)
      Checks whether the field at the specified index is a nested TYPE1 structure, which is a structure with a fixed length in memory, but with a nested layout.
      Parameters:
      index - the index of the field
      Returns:
      true if the specified field is a nested TYPE1 structure, false otherwise
    • isNestedType1Structure

      boolean isNestedType1Structure(String fieldName)
      Checks whether the field with the specified name is a nested TYPE1 structure, which is a structure with a fixed length in memory, but with a nested layout.
      Parameters:
      fieldName - the name of the field
      Returns:
      true if the specified field is a nested TYPE1 structure, false otherwise
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • isTable

      boolean isTable(int index)
      Checks whether the field is a table parameter.
      Parameters:
      index - the index of the field
      Returns:
      true if the specified field is a table parameter, false otherwise
    • isTable

      boolean isTable(String fieldName)
      Checks whether the field with the specified name is a table parameter.
      Parameters:
      fieldName - the name of the field
      Returns:
      true if the specified field is a table parameter, false otherwise
      Throws:
      JCoRuntimeException - with group JCO_ERROR_FIELD_NOT_FOUND, if a field with this name does not exist
    • isAbapObject

      boolean isAbapObject(String fieldName)
      Checks whether the field with the specified name is an ABAP object.
      Parameters:
      fieldName - the name of the field
      Returns:
      true if the specified field is an ABAP object, false otherwise
    • isAbapObject

      boolean isAbapObject(int index)
      Checks whether the field with the specified index is an ABAP object.
      Parameters:
      index - the index of the field
      Returns:
      true if the specified field is an ABAP object, false otherwise
    • lock

      void lock()
      Locks the metadata to prevent further changes.
      Any method that would change the metadata instance will throw an UnsupportedOperationException from then on.
      See Also:
    • isLocked

      boolean isLocked()
      Returns whether this metadata instance is locked.
      Returns:
      true if the metadata instance is locked, false otherwise.
      See Also: