Class JKDbIdValue

java.lang.Object
com.jk.data.dataaccess.core.JKDbIdValue
All Implemented Interfaces:
Serializable

public class JKDbIdValue extends Object implements Serializable
This class represents a database record with an associated ID and value.

This class is used to store pairs of IDs and values retrieved from the database.

It provides utility methods for creating lists of such pairs and accessing their properties.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    This method constructs a new JKDbIdValue.
  • Method Summary

    Modifier and Type
    Method
    Description
    createList(int[] ids, Object[] values)
    This method creates a list of JKDbIdValue instances from arrays of IDs and values.
    createList(Object[] values)
    This method creates a list of JKDbIdValue instances from an array of values.
    This method gets the ID associated with the database record.
    int
    This method gets the ID associated with the database record as integer.
    This method gets the value associated with the database record.
    void
    This method sets the ID associated with the database record.
    void
    This method sets the value associated with the database record.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • JKDbIdValue

      public JKDbIdValue()
      This method constructs a new JKDbIdValue.
  • Method Details

    • createList

      public static Vector<JKDbIdValue> createList(int[] ids, Object[] values)
      This method creates a list of JKDbIdValue instances from arrays of IDs and values.
      Parameters:
      ids - Specifies an array of IDs.
      values - Specifies an array of values.
      Returns:
      the Vector containing JKDbIdValue instances.
    • createList

      public static Vector<JKDbIdValue> createList(Object[] values)
      This method creates a list of JKDbIdValue instances from an array of values.

      Automatically assigns incremental IDs starting from 0.

      Parameters:
      values - Specifies an array of values.
      Returns:
      the Vector containing JKDbIdValue instances with automatically assigned IDs.
    • getId

      public Object getId()
      This method gets the ID associated with the database record.
      Returns:
      the ID associated with the database record.
    • getIdAsInteger

      public int getIdAsInteger()
      This method gets the ID associated with the database record as integer.
      Returns:
      the ID associated with the database record as integer.
    • getValue

      public Object getValue()
      This method gets the value associated with the database record.
      Returns:
      the value associated with the database record.
    • setId

      public void setId(Object id)
      This method sets the ID associated with the database record.
      Parameters:
      id - Specifies the new ID associated with the database record.
    • setValue

      public void setValue(Object value)
      This method sets the value associated with the database record.
      Parameters:
      value - Specifies the new value associated with the database record.
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.