com.amazon.redshift.util

## Class RedshiftObject

- java.lang.Object
- - com.amazon.redshift.util.RedshiftObject

All Implemented Interfaces:
  Serializable, Cloneable

Direct Known Subclasses:
  RedshiftBox, RedshiftCircle, RedshiftInterval, RedshiftLine, RedshiftLseg, RedshiftMoney, RedshiftPath, RedshiftPoint, RedshiftPolygon

    public class RedshiftObject
    extends Object
    implements Serializable, Cloneable

RedshiftObject is a class used to describe unknown types An unknown type is any type that is unknown by JDBC Standards.

See Also:
  Serialized Form

### Field Summary

Fields
`protected String` `type`
`protected String` `value`

### Constructor Summary

Constructors
Constructor and Description
`RedshiftObject()` This is called by com.amazon.redshift.Connection.getObject() to create the object.
`RedshiftObject(String type, String value)`

### Method Summary

Methods
`Object` `clone()` This must be overidden to allow the object to be cloned.
`boolean` `equals(Object obj)` This must be overidden to allow comparisons of objects.
`String` `getType()` As this cannot change during the life of the object, it's final.
`String` `getValue()` This must be overidden, to return the value of the object, in the form required by com.amazon.redshift.
`int` `hashCode()` Compute hash.
`void` `setType(String type)` This method sets the type of this object.
`void` `setValue(String value)` This method sets the value of this object.
`String` `toString()` This is defined here, so user code need not overide it.

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### type

    protected String type

#### value

    protected String value

### Constructor Detail

#### RedshiftObject

    public RedshiftObject()

This is called by com.amazon.redshift.Connection.getObject() to create the object.

#### RedshiftObject

    public RedshiftObject(String type,
                  String value)

### Method Detail

#### setType

    public final void setType(String type)

This method sets the type of this object.

It should not be extended by subclasses, hence it is final

Parameters:
  `type` - a string describing the type of the object

#### setValue

    public void setValue(String value)
                  throws SQLException

This method sets the value of this object. It must be overridden.

Parameters:
  `value` - a string representation of the value of the object
Throws:
  `SQLException` - thrown if value is invalid for this type

#### getType

    public final String getType()

As this cannot change during the life of the object, it's final.

Returns:
  the type name of this object

#### getValue

    public String getValue()

This must be overidden, to return the value of the object, in the form required by com.amazon.redshift.

Returns:
  the value of this object

#### equals

    public boolean equals(Object obj)

This must be overidden to allow comparisons of objects.

Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - Object to compare with
Returns:
  true if the two boxes are identical

#### clone

    public Object clone()
                 throws CloneNotSupportedException

This must be overidden to allow the object to be cloned.

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`

#### toString

    public String toString()

This is defined here, so user code need not overide it.

Overrides:
  `toString` in class `Object`
Returns:
  the value of this object, in the syntax expected by com.amazon.redshift

#### hashCode

    public int hashCode()

Compute hash. As equals() use only value. Return the same hash for the same value.

Overrides:
  `hashCode` in class `Object`
Returns:
  Value hashcode, 0 if value is null `Objects.hashCode(Object)`