org.objectweb.kilim.description
Class Binding

java.lang.Object
  extended byorg.objectweb.kilim.description.TemplateElementImpl
      extended byorg.objectweb.kilim.description.Binding
All Implemented Interfaces:
java.lang.Cloneable, TemplateElement

public class Binding
extends TemplateElementImpl

Author:
horn This class describes the binding between to bindable elements. Initially limited to describe bindings between ports, it has been extended to allow the binding of a port to any kind of value sources.

Field Summary
private  java.util.List boundProviders
           
private  java.lang.String portName
           
 
Fields inherited from class org.objectweb.kilim.description.TemplateElementImpl
 
Constructor Summary
Binding(java.lang.String aPort, TemplateDescription aTemplate)
          The public constructor of a binding object.
 
Method Summary
 void bindProvider(BasicElement aElement)
          adds the target bound port.
 java.util.Iterator getBoundProviders()
          returns as an iterator the bound target providers.
 java.lang.String getPortName()
          returns the name of the bound port.
 void setPortName(java.lang.String aPortName)
          sets the name of the bound port
 void unbindProvider(BasicElement aElement)
          removes a previously bound source.
 
Methods inherited from class org.objectweb.kilim.description.TemplateElementImpl
clone, getContainingTemplate, getTemplateDefHierarchy, setContainingTemplate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

portName

private java.lang.String portName

boundProviders

private java.util.List boundProviders
Constructor Detail

Binding

public Binding(java.lang.String aPort,
               TemplateDescription aTemplate)
        throws KilimException
The public constructor of a binding object.

Parameters:
aPort - : reference of the port to be bound.
aTemplate - : reference of the containing template.
Throws:
KilimException - : generated when the port reference is null or when the template reference is null.
Method Detail

getPortName

public java.lang.String getPortName()
returns the name of the bound port.

Returns:
String

setPortName

public void setPortName(java.lang.String aPortName)
sets the name of the bound port

Parameters:
aPortName - : the port name

getBoundProviders

public java.util.Iterator getBoundProviders()
returns as an iterator the bound target providers. The iterator contains at most one element if the port is unary. It may contain several providers if the port is nary.

Returns:
Iterator : it returns KILIM.EMPTY_ITERATOR if the port is not bound to any source.

bindProvider

public void bindProvider(BasicElement aElement)
                  throws KilimException
adds the target bound port.

Parameters:
aElement - : the value source the port should be bound to.
Throws:
KilimException - : generated when the element is null.

unbindProvider

public void unbindProvider(BasicElement aElement)
                    throws KilimException
removes a previously bound source.

Parameters:
aElement - : the element to unbind.
Throws:
KilimException - : generated when the reference of the element is null or when the binding is empty.