org.jfree.chart.entity

## Class LegendItemEntity

- java.lang.Object
- - org.jfree.chart.entity.ChartEntity
  - - org.jfree.chart.entity.LegendItemEntity

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, org.jfree.util.PublicCloneable

    public class LegendItemEntity
    extends ChartEntity
    implements java.lang.Cloneable, java.io.Serializable

An entity that represents an item within a legend.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`LegendItemEntity(java.awt.Shape area)` Creates a legend item entity.

### Method Summary

Methods
`java.lang.Object` `clone()` Returns a clone of the entity.
`boolean` `equals(java.lang.Object obj)` Tests this object for equality with an arbitrary object.
`Dataset` `getDataset()` Returns a reference to the dataset that this legend item is derived from.
`int` `getSeriesIndex()` Deprecated. As of 1.0.6, use the `getSeriesKey()` method.
`java.lang.Comparable` `getSeriesKey()` Returns the series key that identifies the legend item.
`void` `setDataset(Dataset dataset)` Sets a reference to the dataset that this legend item is derived from.
`void` `setSeriesIndex(int index)` Deprecated. As of 1.0.6, use the `setSeriesKey(Comparable)` method.
`void` `setSeriesKey(java.lang.Comparable key)` Sets the key for the series.
`java.lang.String` `toString()` Returns a string representing this object (useful for debugging purposes).

### Methods inherited from class org.jfree.chart.entity.ChartEntity

`getArea, getImageMapAreaTag, getShapeCoords, getShapeType, getToolTipText, getURLText, hashCode, setArea, setToolTipText, setURLText`

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

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

### Constructor Detail

#### LegendItemEntity

    public LegendItemEntity(java.awt.Shape area)

Creates a legend item entity.

Parameters:
  `area` - the area.

### Method Detail

#### getDataset

    public Dataset getDataset()

Returns a reference to the dataset that this legend item is derived from.

Returns:
  The dataset.
Since:
  1.0.6
See Also:
  `setDataset(Dataset)`

#### setDataset

    public void setDataset(Dataset dataset)

Sets a reference to the dataset that this legend item is derived from.

Parameters:
  `dataset` - the dataset.
Since:
  1.0.6

#### getSeriesKey

    public java.lang.Comparable getSeriesKey()

Returns the series key that identifies the legend item.

Returns:
  The series key.
Since:
  1.0.6
See Also:
  `setSeriesKey(Comparable)`

#### setSeriesKey

    public void setSeriesKey(java.lang.Comparable key)

Sets the key for the series.

Parameters:
  `key` - the key.
Since:
  1.0.6
See Also:
  `getSeriesKey()`

#### getSeriesIndex

    public int getSeriesIndex()

Deprecated. As of 1.0.6, use the `getSeriesKey()` method.
Returns the series index.

Returns:
  The series index.
See Also:
  `setSeriesIndex(int)`

#### setSeriesIndex

    public void setSeriesIndex(int index)

Deprecated. As of 1.0.6, use the `setSeriesKey(Comparable)` method.
Sets the series index.

Parameters:
  `index` - the series index.
See Also:
  `getSeriesIndex()`

#### equals

    public boolean equals(java.lang.Object obj)

Tests this object for equality with an arbitrary object.

Overrides:
  `equals` in class `ChartEntity`
Parameters:
  `obj` - the object (`null` permitted).
Returns:
  A boolean.

#### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

Returns a clone of the entity.

Specified by:
  `clone` in interface `org.jfree.util.PublicCloneable`
Overrides:
  `clone` in class `ChartEntity`
Returns:
  A clone.
Throws:
  `java.lang.CloneNotSupportedException` - if there is a problem cloning the object.

#### toString

    public java.lang.String toString()

Returns a string representing this object (useful for debugging purposes).

Overrides:
  `toString` in class `ChartEntity`
Returns:
  A string (never `null`).