org.objectweb.fractal.julia
Class BasicComponentInterface

java.lang.Object
  extended by org.objectweb.fractal.julia.BasicComponentInterface
All Implemented Interfaces:
Interface, ComponentInterface

public abstract class BasicComponentInterface
extends Object
implements ComponentInterface

Provides a basic implementation of the ComponentInterface interface.


Field Summary
protected  int flags
          The flags of this component interfaces.
protected  String name
          The name of this component interface.
protected  Component owner
          The component to which this component interface belongs.
protected  Type type
          The type of this component interface.
 
Constructor Summary
BasicComponentInterface()
          Constructs an uninitialized BasicComponentInterface.
BasicComponentInterface(Component owner, String name, Type type, boolean isInternal, Object impl)
          Constructs a new BasicComponentInterface.
 
Method Summary
 Object clone()
          Creates and returns a copy of this component interface.
 boolean equals(Object o)
          Tests if the given object is equal to this component interface.
 String getFcItfName()
           
 Component getFcItfOwner()
           
 Type getFcItfType()
           
 boolean hasFcInterceptor()
          Returns true if this interface has a permanently associated interceptor.
 int hashCode()
          Returns the hash code of this component interface.
 boolean isFcInternalItf()
           
 void setFcItfName(String name)
          Sets the name of this component interface.
 void updateFcState()
          Update the internal state of this interface.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.fractal.julia.ComponentInterface
getFcItfImpl, setFcItfImpl
 

Field Detail

owner

protected Component owner
The component to which this component interface belongs.


name

protected String name
The name of this component interface.


type

protected Type type
The type of this component interface.


flags

protected int flags
The flags of this component interfaces. These flags indicates if this component interface is an internal interface or not, and if it has an permanently associated interceptor or not.

Constructor Detail

BasicComponentInterface

public BasicComponentInterface()
Constructs an uninitialized BasicComponentInterface. This default public constructor is needed for the implementation of the clone method.


BasicComponentInterface

public BasicComponentInterface(Component owner,
                               String name,
                               Type type,
                               boolean isInternal,
                               Object impl)
Constructs a new BasicComponentInterface.

Parameters:
owner - the component to which the interface belongs. If this parameter is null the owner is set to the interface itself, which must therefore be a Component interface.
name - the name of the interface.
type - the type of the interface.
isInternal - true if the interface is an internal interface.
impl - the object that implements the interface.
Method Detail

getFcItfOwner

public Component getFcItfOwner()
Specified by:
getFcItfOwner in interface Interface

getFcItfName

public String getFcItfName()
Specified by:
getFcItfName in interface Interface

getFcItfType

public Type getFcItfType()
Specified by:
getFcItfType in interface Interface

isFcInternalItf

public boolean isFcInternalItf()
Specified by:
isFcInternalItf in interface Interface

setFcItfName

public void setFcItfName(String name)
Description copied from interface: ComponentInterface
Sets the name of this component interface.

Specified by:
setFcItfName in interface ComponentInterface
Parameters:
name - the new name of this component interface.

hasFcInterceptor

public boolean hasFcInterceptor()
Description copied from interface: ComponentInterface
Returns true if this interface has a permanently associated interceptor. Note that, due to the algorithm to compute shortcut links between components, the object that implements this component interface may temporarily be an interceptor object, even if this interface has no permanently associated interceptor. This method is therefore NOT equivalent to getFcItfImpl instanceof Interceptor (but it implies it).

Specified by:
hasFcInterceptor in interface ComponentInterface
Returns:
true if this interface has a permanently associated interceptor.

updateFcState

public void updateFcState()
Update the internal state of this interface. Needed to be able to dynamically add or remove an interceptor. The original code only sets flags in the constructor. When an interceptor is dynamically added, the fact that hasInterceptor() returns false causes an incorrect behavior of the BindingController which ignores the added interceptor. The updateFcState() method is meant to be called whenever an interceptor is added or removed to update the value of flags. This solution has been preferred to the more intruisive one which would have consisted in changing the implementation of hasFcInterceptor() to: (getFcImpl() instanceof Interceptor).

Specified by:
updateFcState in interface ComponentInterface
Since:
2.5

hashCode

public int hashCode()
Returns the hash code of this component interface.

Overrides:
hashCode in class Object
Returns:
the hash code of this component interface.

equals

public boolean equals(Object o)
Tests if the given object is equal to this component interface.

Overrides:
equals in class Object
Parameters:
o - the object to be compared to this component interface.
Returns:
true if o is a component interface with the same name and owner as this component interface, and if both are internal (resp. external) component interfaces.

clone

public Object clone()
Description copied from interface: ComponentInterface
Creates and returns a copy of this component interface.

Specified by:
clone in interface ComponentInterface
Overrides:
clone in class Object
Returns:
a copy of this component interface.