bluej.extensions
Class BObject

java.lang.Object
  extended bybluej.extensions.BObject

public class BObject
extends java.lang.Object

A wrapper for an object on the BlueJ object bench. This wraps an object so you can add and remove it from the bench.

Version:
$Id: BObject.java,v 1.32 2003/11/10 14:49:42 damiano Exp $
See Also:
BConstructor, BMethod, BField

Method Summary
 void addToBench(java.lang.String instanceName)
          Adds this object on the object bench.
 BClass getBClass()
          Return the class of this object.
 java.lang.String getInstanceName()
          Return the name of this object on the object bench.
 BPackage getPackage()
          Returns the package this object belongs to.
 void removeFromBench()
          Removes this object from the object bench.
 java.lang.String toString()
          Returns a string representation of the Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPackage

public BPackage getPackage()
                    throws ProjectNotOpenException,
                           PackageNotFoundException
Returns the package this object belongs to.

Throws:
ProjectNotOpenException - if the project to which this object belongs has been closed by the user.
PackageNotFoundException - if the package to which this object belongs has been deleted by the user.

removeFromBench

public void removeFromBench()
                     throws ProjectNotOpenException,
                            PackageNotFoundException
Removes this object from the object bench. This will also remove it from the view of the object bench. Once the object is removed from the bench it will not be available again.

Throws:
ProjectNotOpenException - if the project to which this object belongs has been closed by the user.
PackageNotFoundException - if the package to which this object belongs has been deleted by the user.

addToBench

public void addToBench(java.lang.String instanceName)
                throws ProjectNotOpenException,
                       PackageNotFoundException
Adds this object on the object bench. If you pass null as instanceName the object will have a predefined name. If the object is not a valid one nothing will happen.

Parameters:
instanceName - The name you want this object to have on the bench.
Throws:
ProjectNotOpenException - if the project to which this object belongs has been closed by the user.
PackageNotFoundException - if the package to which this object belongs has been deleted by the user.

getInstanceName

public java.lang.String getInstanceName()
Return the name of this object on the object bench.

Returns:
The instance name if the object can be put into bench, null othervise

getBClass

public BClass getBClass()
                 throws ProjectNotOpenException,
                        ClassNotFoundException
Return the class of this object. Similar to Reflection API. Note the naming inconsistency, which avoids a clash with java.lang.Object.getClass()

Throws:
ProjectNotOpenException - if the project to which this object belongs has been closed by the user.
ClassNotFoundException - if the class has been deleted by the user.

toString

public java.lang.String toString()
Returns a string representation of the Object



BlueJ homepage