Class BArray


  • public class BArray
    extends java.lang.Object
    A wrapper for an array object in BlueJ. Behaviour is similar to the Java reflection API.
    Author:
    Damiano Bolla, University of Kent at Canterbury, 2003
    • Constructor Summary

      Constructors 
      Constructor Description
      BArray()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object getValue​(BObject thisArray, int itemIndex)
      Given an array BObject, returns the item at the given index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BArray

        public BArray()
    • Method Detail

      • getValue

        public static java.lang.Object getValue​(BObject thisArray,
                                                int itemIndex)
                                         throws ProjectNotOpenException,
                                                PackageNotFoundException
        Given an array BObject, returns the item at the given index. In the case that the array contains elements of primitive type (int etc.), the return value is of the appropriate Java wrapper type (Integer etc.). In the case that the array is composed of BlueJ objects (including nested arrays) then an appropriate BObject will be returned.
        Parameters:
        thisArray - a array BObject to retrieve the specified item of.
        itemIndex - the index of the BArray's item to retrieve.
        Returns:
        An Object that encapsulate the specific item or null if thisArray is not an array.
        Throws:
        ProjectNotOpenException - if the project to which this array belongs has been closed by the user.
        PackageNotFoundException - if the package to which this array belongs has been deleted by the user.