## javax.media.jai.remote
Class NegotiableCollection

    java.lang.Object
      |
      +--javax.media.jai.remote.NegotiableCollection

All Implemented Interfaces:
  Negotiable, java.io.Serializable

public class NegotiableCollection
extends java.lang.Object
implements Negotiable

A class that wraps an `Collection` to implement the `Negotiable` interface. `NegotiableCollection` is a convenience class to specify a `Negotiable` value for a parameter whose valid values are contained in an `Collection`.

Since:
  1.1
See Also:
  Serialized Form

Constructor Summary
`NegotiableCollection(java.util.Collection collection)` Creates a `NegotiableCollection` given an `Collection`.
`NegotiableCollection(java.lang.Object[] objects)` Creates a `NegotiableCollection` given an array of `Object`s.

Method Summary
`java.util.Collection` `getCollection()` Returns the `Collection` of values which are currently valid for this class, null if there are no valid values.
`java.lang.Object` `getNegotiatedValue()` Returns a single value that is valid for this `NegotiableCollection`.
`java.lang.Class` `getNegotiatedValueClass()` Returns the `Class` of the Object returned as the result of the negotiation.
`Negotiable` `negotiate(Negotiable other)` Returns a `NegotiableCollection` that contains those elements that are common to this `NegotiableCollection` and the one supplied.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NegotiableCollection

    public NegotiableCollection(java.util.Collection collection)

  Creates a `NegotiableCollection` given an `Collection`.
  Throws:
    `java.lang.IllegalArgumentException` - if collection is null.
    `java.lang.IllegalArgumentException` - if all the elements of collection are not of the same `Class` type.

### NegotiableCollection

    public NegotiableCollection(java.lang.Object[] objects)

  Creates a `NegotiableCollection` given an array of `Object`s. The elements of the `Object` array are treated as being the elements of an `Collection`.
  Throws:
    `java.lang.IllegalArgumentException` - if objects is null.
    `java.lang.IllegalArgumentException` - if all the elements of objects are not of the same `Class` type.

Method Detail

### getCollection

    public java.util.Collection getCollection()

  Returns the `Collection` of values which are currently valid for this class, null if there are no valid values.

### negotiate

    public Negotiable negotiate(Negotiable other)

  Returns a `NegotiableCollection` that contains those elements that are common to this `NegotiableCollection` and the one supplied. If the supplied `Negotiable` is not a `NegotiableCollection` with its elements being of the same `Class` as this class', or if there are no common elements, the negotiation will fail and `null` (signifying the failure of the negotiation) will be returned.
  Specified by:
    `negotiate` in interface `Negotiable`
  Parameters:
    `other` - The `Negotiable` to negotiate with.

### getNegotiatedValue

    public java.lang.Object getNegotiatedValue()

  Returns a single value that is valid for this `NegotiableCollection`. The returned value is the first element contained in this `NegotiableCollection`. Returns `null` if there are no valid elements in this `NegotiableCollection`.
  Specified by:
    `getNegotiatedValue` in interface `Negotiable`

### getNegotiatedValueClass

    public java.lang.Class getNegotiatedValueClass()

  Returns the `Class` of the Object returned as the result of the negotiation. If the `Collection` used to construct this `NegotiableCollection` was empty, i.e. had no elements, the `Class` of the elements is indeterminate, therefore null will be returned from this method in such a case.
  Specified by:
    `getNegotiatedValueClass` in interface `Negotiable`