|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bluej.extensions.BClass
public class BClass
A wrapper for a class. This is used to represent both classes which have a representation within the BlueJ project, and those that don't.
From an instance of this class you can create BlueJ objects and call their methods. Behaviour is similar to the Java reflection API.
Method Summary | |
---|---|
void |
beginChangeSource()
Deprecated. As of BlueJ 2.0, replaced by Editor.setReadOnly(boolean readOnly) |
void |
compile(boolean waitCompileEnd)
Compile this class, and any dependents. |
void |
compile(boolean waitCompileEnd,
boolean forceQuiet)
Compile this class, and any dependents, optionally without showing compilation errors to the user. |
void |
endChangeSource()
Deprecated. As of BlueJ 2.0, replaced by Editor.setReadOnly(boolean readOnly) |
java.io.File |
getClassFile()
Returns this class's .class file (or null, if the class no longer exists in the project). |
BConstructor |
getConstructor(java.lang.Class<?>[] signature)
Returns the constructor for this class which has the given signature. |
BConstructor[] |
getConstructors()
Returns all the constructors of this class. |
BMethod |
getDeclaredMethod(java.lang.String methodName,
java.lang.Class<?>[] params)
Returns the declared method of this class which has the given signature. |
BMethod[] |
getDeclaredMethods()
Returns the declared methods of this class. |
Editor |
getEditor()
Returns a proxy object that provide an interface to the editor for this BClass. |
BField |
getField(java.lang.String fieldName)
Returns the field of this class which has the given name. |
BField[] |
getFields()
Returns all the fields of this class. |
java.lang.Class<?> |
getJavaClass()
Returns the Java class being wrapped by this BClass. |
java.io.File |
getJavaFile()
Returns this class's .java file. |
BMethod |
getMethod(java.lang.String methodName,
java.lang.Class<?>[] params)
Returns the method of this class with the given signature. |
BMethod[] |
getMethods()
Returns all methods of this class, those declared and those inherited from all ancestors. |
java.lang.String |
getName()
Returns the name of this BClass. |
BPackage |
getPackage()
Returns the package this class belongs to. |
BClass |
getSuperclass()
Returns the superclass of this class. |
boolean |
isCompiled()
Checks to see if this class has been compiled. |
void |
remove()
Removes this class from BlueJ, including the underlying files. |
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 |
---|
public final java.lang.String getName()
public void remove() throws ProjectNotOpenException, PackageNotFoundException, ClassNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.
ClassNotFoundException
- if the class has been deleted by the user, or if the class does
not otherwise have a representation within the project.public java.lang.Class<?> getJavaClass() throws ProjectNotOpenException, ClassNotFoundException
Note that this is for information only. If you want to interact with BlueJ you must use the methods provided in BClass.
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BPackage getPackage() throws ProjectNotOpenException, PackageNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public Editor getEditor() throws ProjectNotOpenException, PackageNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public boolean isCompiled() throws ProjectNotOpenException, PackageNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public void compile(boolean waitCompileEnd) throws ProjectNotOpenException, PackageNotFoundException, CompilationNotStartedException
After the compilation has finished the method isCompiled() can be used to determined the class status.
A single CompileEvent will be generated with all dependent files listed.
A call to this method is equivalent to: compile(waitCompileEnd, false)
.
waitCompileEnd
- true
waits for the compilation to be finished.
ProjectNotOpenException
- if the project to which this class belongs has been closed.
PackageNotFoundException
- if the package to which this class belongs has been deleted.
CompilationNotStartedException
- if BlueJ is currently executing Java code.public void compile(boolean waitCompileEnd, boolean forceQuiet) throws ProjectNotOpenException, PackageNotFoundException, CompilationNotStartedException
After the compilation has finished the method isCompiled() can be used to determined the class status.
A single CompileEvent with all dependent files listed will be generated.
waitCompileEnd
- true
waits for the compilation to be finished.forceQuiet
- if true, compilation errors will not be shown/highlighted to the user.
ProjectNotOpenException
- if the project to which this class belongs has been closed.
PackageNotFoundException
- if the package to which this class belongs has been deleted.
CompilationNotStartedException
- if BlueJ is currently executing Java code.public BClass getSuperclass() throws ProjectNotOpenException, PackageNotFoundException, ClassNotFoundException
Similar to reflection API.
If this class represents either the Object class, an interface, a primitive type, or void, then null is returned.
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BConstructor[] getConstructors() throws ProjectNotOpenException, ClassNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BConstructor getConstructor(java.lang.Class<?>[] signature) throws ProjectNotOpenException, ClassNotFoundException
signature
- the signature of the required constructor.
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BMethod[] getDeclaredMethods() throws ProjectNotOpenException, ClassNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BMethod getDeclaredMethod(java.lang.String methodName, java.lang.Class<?>[] params) throws ProjectNotOpenException, ClassNotFoundException
methodName
- The name of the method.params
- The parameters of the method. Pass a zero length array if the method takes no arguments.
null
if the method is not found.
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BMethod[] getMethods() throws ProjectNotOpenException, ClassNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BMethod getMethod(java.lang.String methodName, java.lang.Class<?>[] params) throws ProjectNotOpenException, ClassNotFoundException
methodName
- The name of the methodparams
- The parameters of the method. Pass a zero length array if the method takes no arguments.
null
if the method is not found.
ProjectNotOpenException
- If the project to which this class belongs has been closed by the user
ClassNotFoundException
- If the class has been deleted by the userpublic BField[] getFields() throws ProjectNotOpenException, ClassNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public BField getField(java.lang.String fieldName) throws ProjectNotOpenException, ClassNotFoundException
fieldName
- Description of the Parameter
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
ClassNotFoundException
- if the class has been deleted by the user.public java.io.File getClassFile() throws ProjectNotOpenException, PackageNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public java.io.File getJavaFile() throws ProjectNotOpenException, PackageNotFoundException
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public void beginChangeSource() throws ProjectNotOpenException, PackageNotFoundException
Editor.setReadOnly(boolean readOnly)
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public void endChangeSource() throws ProjectNotOpenException, PackageNotFoundException
Editor.setReadOnly(boolean readOnly)
ProjectNotOpenException
- if the project to which this class belongs has been closed by the user.
PackageNotFoundException
- if the package to which this class belongs has been deleted by the user.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |