Package org.postgresql.geometric

# Class PGpolygon

java.lang.Object
org.postgresql.util.PGobject
org.postgresql.geometric.PGpolygon

All Implemented Interfaces:
  `Serializable`, `Cloneable`

public class PGpolygon extends PGobject implements Serializable, Cloneable
This implements the polygon datatype within PostgreSQL.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`PGpoint @Nullable []`
`points`
The points defining the polygon.

### Fields inherited from class org.postgresql.util.PGobject

`type, value`

## Constructor Summary

Constructors
Constructor
Description
`PGpolygon()`
Required by the driver.
`PGpolygon(String s)`
`PGpolygon(PGpoint[] points)`
Creates a polygon using an array of PGpoints.

## Method Summary

Modifier and Type
Method
Description
`Object`
`clone()`
This must be overridden to allow the object to be cloned.
`boolean`
`equals(@Nullable Object obj)`
This must be overridden to allow comparisons of objects.
`@Nullable String`
`getValue()`
This must be overridden, to return the value of the object, in the form required by org.postgresql.
`int`
`hashCode()`
Compute hash.
`void`
`setValue(@Nullable String s)`
This method sets the value of this object.

### Methods inherited from class org.postgresql.util.PGobject

`equals, getType, isNull, setType, toString`

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

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

## Field Details

### points

public PGpoint @Nullable [] points
The points defining the polygon.

## Constructor Details

### PGpolygon

public PGpolygon(PGpoint[] points)
Creates a polygon using an array of PGpoints.

Parameters:
  `points` - the points defining the polygon

### PGpolygon

public PGpolygon(String s) throws SQLException

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

### PGpolygon

public PGpolygon()
Required by the driver.

## Method Details

### setValue

public void setValue(@Nullable String s) throws SQLException
Description copied from class: `PGobject`
This method sets the value of this object. It must be overridden.

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

### equals

public boolean equals(@Nullable Object obj)
Description copied from class: `PGobject`
This must be overridden to allow comparisons of objects.

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

### hashCode

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

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

### clone

public Object clone() throws CloneNotSupportedException
Description copied from class: `PGobject`
This must be overridden to allow the object to be cloned.

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

### getValue

public @Nullable String getValue()
Description copied from class: `PGobject`
This must be overridden, to return the value of the object, in the form required by org.postgresql.

Overrides:
  `getValue` in class `PGobject`
Returns:
  the PGpolygon in the syntax expected by org.postgresql