com.amazon.redshift.geometric

## Class RedshiftPolygon

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

All Implemented Interfaces:
  Serializable, Cloneable

    public class RedshiftPolygon
    extends RedshiftObject
    implements Serializable, Cloneable

This implements the polygon datatype within Redshift.

See Also:
  Serialized Form

### Field Summary

Fields
`RedshiftPoint[]` `points` The points defining the polygon.

### Fields inherited from class com.amazon.redshift.util.RedshiftObject

`type, value`

### Constructor Summary

Constructors
Constructor and Description
`RedshiftPolygon()` Required by the driver.
`RedshiftPolygon(RedshiftPoint[] points)` Creates a polygon using an array of RedshiftPoints.
`RedshiftPolygon(String s)`

### 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` `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` `setValue(String s)` This method sets the value of this object.

### Methods inherited from class com.amazon.redshift.util.RedshiftObject

`getType, setType, toString`

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

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

### Field Detail

#### points

    public RedshiftPoint[] points

The points defining the polygon.

### Constructor Detail

#### RedshiftPolygon

    public RedshiftPolygon(RedshiftPoint[] points)

Creates a polygon using an array of RedshiftPoints.

Parameters:
  `points` - the points defining the polygon

#### RedshiftPolygon

    public RedshiftPolygon(String s)
                    throws SQLException

Parameters:
  `s` - definition of the polygon in Redshift's syntax.
Throws:
  `SQLException` - on conversion failure

#### RedshiftPolygon

    public RedshiftPolygon()

Required by the driver.

### Method Detail

#### setValue

    public void setValue(String s)
                  throws SQLException

Description copied from class: `RedshiftObject`
This method sets the value of this object. It must be overridden.

Overrides:
  `setValue` in class `RedshiftObject`
Parameters:
  `s` - Definition of the polygon in Redshift's syntax
Throws:
  `SQLException` - on conversion failure

#### equals

    public boolean equals(Object obj)

Description copied from class: `RedshiftObject`
This must be overidden to allow comparisons of objects.

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

#### hashCode

    public int hashCode()

Description copied from class: `RedshiftObject`
Compute hash. As equals() use only value. Return the same hash for the same value.

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

#### clone

    public Object clone()
                 throws CloneNotSupportedException

Description copied from class: `RedshiftObject`
This must be overidden to allow the object to be cloned.

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

#### getValue

    public String getValue()

Description copied from class: `RedshiftObject`
This must be overidden, to return the value of the object, in the form required by com.amazon.redshift.

Overrides:
  `getValue` in class `RedshiftObject`
Returns:
  the RedshiftPolygon in the syntax expected by com.amazon.redshift