Class BObject


  • public class BObject
    extends java.lang.Object
    A wrapper for an object on the BlueJ object bench. This wraps an object the extension can add and remove from the bench.
    Author:
    Clive Miller, University of Kent at Canterbury, 2002, Damiano Bolla, University of Kent at Canterbury 2003,2004
    See Also:
    BConstructor, BMethod, BField
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToBench​(java.lang.String instanceName)
      Adds this object on the object bench.
      BClass getBClass()
      Returns the class of this object.
      java.lang.String getInstanceName()
      Returns 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

      • 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 null is passed as instanceName the object will have a predefined name. If the object is not a valid one nothing will happen.
        Parameters:
        instanceName - The name to be given to this object 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()
        Returns the name of this object on the object bench.
        Returns:
        The instance name if the object can be put into bench, null othervise
      • toString

        public java.lang.String toString()
        Returns a string representation of the Object
        Overrides:
        toString in class java.lang.Object