org.iids.aos.negotiation
Class Restriction

java.lang.Object
  extended by org.iids.aos.negotiation.Restriction
All Implemented Interfaces:
java.io.Serializable

public class Restriction
extends java.lang.Object
implements java.io.Serializable

A wrapper class that filters restrictions from a wsagreement Item. Usually each item has a single restriction associated with it. Each Restriction is part of a single Service which it acts on. These are usually extracted from the Template.

Each Restriction has an associated Restriction.Type which defines the type of restriction.

Author:
rjtimmer
See Also:
Serialized Form

Nested Class Summary
static class Restriction.Type
          The Types of Restrictions that are possible.
 
Constructor Summary
Restriction(Item item)
          Each restriction is associated with a single item.
 
Method Summary
 boolean accepts(java.lang.Object value)
          See if the enumeration contains a compatible value for the given Object.
 java.lang.String getClassName()
          Get the name of the class that this restriction works on.
 java.lang.String getFieldName()
          Get the name of the field that this restriction works on.
 java.lang.String getLocation()
          Get the location of the field that this restriction is defined on.
 java.lang.String getServiceName()
          Returns the service name of the SDT this restriction is associated with.
 Restriction.Type getType()
          Obtain the restriction type for this restriction.
 java.lang.Object getValue()
          Get the value of the restriction.
 java.util.List<java.lang.Object> getValues()
          Return a list of allowed values for a restriction.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Restriction

public Restriction(Item item)
Each restriction is associated with a single item. This restriction wraps the Item, providing some more hight-level access.

Method Detail

accepts

public boolean accepts(java.lang.Object value)
See if the enumeration contains a compatible value for the given Object.

TODO This only works if the type of the object is Enum. Integers are to be done later. Only works if enum content is Comparable.

Returns:
true If the restriction type is an enumeration and the restriction value of the parameter is part of that enumeration.

getType

public Restriction.Type getType()
Obtain the restriction type for this restriction. A Restriction Type is either Min, Max or Enum (a list of allowed values).


getValue

public java.lang.Object getValue()
Get the value of the restriction. For Min/Max this is the minimal (or maximal) allowed value. For Enum types, this is a list of allowed values. The actual type of the value (int, string, etc) will have to be known by the application.


getValues

public java.util.List<java.lang.Object> getValues()
Return a list of allowed values for a restriction. This is usually only useful for Enum restriction types, but it can be used for Min and Max restrictions (in which case the list has only one element).


getServiceName

public java.lang.String getServiceName()
Returns the service name of the SDT this restriction is associated with.


getLocation

public java.lang.String getLocation()
Get the location of the field that this restriction is defined on.


getFieldName

public java.lang.String getFieldName()
Get the name of the field that this restriction works on. Extracted from the result of getLocation().


getClassName

public java.lang.String getClassName()
Get the name of the class that this restriction works on. Extracted from the result of getLocation().


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.