com.borland.jbuilder.jot
Interface JotClassSource

All Superinterfaces:
JotClass, JotCommentable, JotMarker
All Known Subinterfaces:
JotAnonymousClass, JotInnerClass

public interface JotClassSource
extends JotClass, JotCommentable, JotMarker

This interface provides additional methods for manipulating a class' source. For more information about classes see chapter 8 of the Java Language Specification.


Method Summary
 JotConstructorSource addConstructor(JotMarker marker, boolean before)
          Adds a constructor to the class and returns an instance of JotConstructorSource that represents the constructor.
 JotFieldDeclaration addField(JotMarker marker, boolean before, java.lang.String variableType, java.lang.String name)
          Adds a field declaration to the class and returns an instance of JotFieldDeclaration that represents the field.
 JotInitBlock addInitBlock(JotMarker marker, boolean before, int mods)
          Adds an initialization block to the class and returns an instance of JotInitBlock that represents the block.
 JotInnerClass addInnerClass(JotMarker marker, boolean before, java.lang.String name, boolean isInterface)
          Adds an inner class to the class and returns an instance of JotInnerClass that represents the class.
 JotType addInterface(JotMarker marker, boolean before, java.lang.String interfaceName)
          Adds an interface to the implements clause for the class.
 JotMethodSource addMethod(JotMarker marker, boolean before, java.lang.String returnType, java.lang.String name)
          Adds a method implementation to the class and returns an instance of JotMethodSource that represents the method.
 JotMethodSource addMethodDeclaration(JotMarker marker, boolean before, java.lang.String returnType, java.lang.String name)
          Adds a method declaration (i.e.
 int getComparableLocation(JotMarker m)
          Given a marker in the JotClass, returns a value that can be compared against another marker so as to determine which comes before the other in the source
 int getDeclaredModifiers()
          Returns only the modifiers actually declared in the file.
 JotSourceFile getDeclaringFile()
          Returns the JotSourceFile containing the class represented by this JotClassSource instance.
 void removeConstructor(JotConstructor method)
          Removes the specified constructor from the class.
 void removeField(JotField field)
          Removes the specified field's declaration from the class.
 void removeInitBlock(JotInitBlock block)
          Removes the specified initialization block from the class.
 void removeInnerClass(JotInnerClass inner)
          Removes the specified inner class from the class.
 void removeInterface(JotType iface)
          Removes the specified interface from the implements clause.
 void removeMethod(JotMethod method)
          Removes the specified method from the class.
 void setModifiers(int modifiers)
          Specify the modifiers for the class.
 void setName(java.lang.String name)
          Specifies the unqualified name of the class.
 void setSuperclass(java.lang.String Superclass)
          Specifies the superclass of the class.
 
Methods inherited from interface com.borland.jbuilder.jot.JotClass
addUserData, getComponentType, getConstructor, getConstructors, getDeclaredConstructor, getDeclaredConstructors, getDeclaredField, getDeclaredFields, getDeclaredInnerClasses, getDeclaredMethod, getDeclaredMethods, getDeclaredMethods, getField, getFields, getFile, getInnerClasses, getInterfaces, getMethod, getMethods, getMethods, getModifiers, getName, getSuperclass, getType, getUserData, isArray, isAssignableFrom, isInstance, isInterface, isPrimitive, newInstance
 
Methods inherited from interface com.borland.jbuilder.jot.JotCommentable
addBlankLine, addComment, getComment, removeComment
 
Methods inherited from interface com.borland.jbuilder.jot.JotMarker
addUserData, getEndPosition, getStartPosition, getUserData
 

Method Detail

setName

public void setName(java.lang.String name)
Specifies the unqualified name of the class.

getDeclaringFile

public JotSourceFile getDeclaringFile()
Returns the JotSourceFile containing the class represented by this JotClassSource instance.

getDeclaredModifiers

public int getDeclaredModifiers()
Returns only the modifiers actually declared in the file. Use with the static methods of java.lang.reflect.Modifier to determine whether a specific modifer is set.

setModifiers

public void setModifiers(int modifiers)
Specify the modifiers for the class. Use the static variables of java.lang.reflect.Modifier to create the combination of modifiers desired by OR-ing the values.

See Also:
Modifier

setSuperclass

public void setSuperclass(java.lang.String Superclass)
Specifies the superclass of the class. The given name does not need to be qualified.

addInterface

public JotType addInterface(JotMarker marker,
                            boolean before,
                            java.lang.String interfaceName)
Adds an interface to the implements clause for the class. The specified name does not need to be qualified. Returns a JotType instance representing the interface. If 'marker' is not null, then the name will be inserted in the implements clause either before or after the marker depending on the value of 'before'.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
interfaceName - is the name of the interface being implemented.

removeInterface

public void removeInterface(JotType iface)
Removes the specified interface from the implements clause.

addInnerClass

public JotInnerClass addInnerClass(JotMarker marker,
                                   boolean before,
                                   java.lang.String name,
                                   boolean isInterface)
Adds an inner class to the class and returns an instance of JotInnerClass that represents the class. If isInterface is true, then the class will be declared as an interface. If 'marker' is not null, then the field will be inserted in the class either before or after the marker depending on the value of 'before'.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
name - The name of inner class.
isInterface - Determins if the inner class is an interface.

removeInnerClass

public void removeInnerClass(JotInnerClass inner)
Removes the specified inner class from the class.

addField

public JotFieldDeclaration addField(JotMarker marker,
                                    boolean before,
                                    java.lang.String variableType,
                                    java.lang.String name)
Adds a field declaration to the class and returns an instance of JotFieldDeclaration that represents the field. The declared field will have the specified name and type. If 'marker' is not null, then the field will be inserted in the class either before or after the marker depending on the value of 'before'.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
variableType - The datatype for the variable declaration.
name - The name of the variable.

removeField

public void removeField(JotField field)
Removes the specified field's declaration from the class.

addMethod

public JotMethodSource addMethod(JotMarker marker,
                                 boolean before,
                                 java.lang.String returnType,
                                 java.lang.String name)
Adds a method implementation to the class and returns an instance of JotMethodSource that represents the method. The method will have the specified name and type. If 'marker' is not null, then the method will be inserted in the class either before or after the marker depending on the value of 'before'.

This method is used to create method implementations. See addMethodDeclaration() for creating abstract methods.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
returnType - The return type for the method.

addMethodDeclaration

public JotMethodSource addMethodDeclaration(JotMarker marker,
                                            boolean before,
                                            java.lang.String returnType,
                                            java.lang.String name)
Adds a method declaration (i.e. the method has no body) to the class and returns an instance of JotMethodSource that represents the method. The method will have the specified name and type. If 'marker' is not null, then the method will be inserted in the class either before or after the marker depending on the value of 'before'.

This method is used to create method prototypes in an interface or to create abstract methods. See addMethod() for creating method implementations.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
returnType - The return type for the method.

removeMethod

public void removeMethod(JotMethod method)
Removes the specified method from the class.

addConstructor

public JotConstructorSource addConstructor(JotMarker marker,
                                           boolean before)
Adds a constructor to the class and returns an instance of JotConstructorSource that represents the constructor. The name of the constructor will be the same as the name of the class. If 'marker' is not null, then the constructor will be inserted in the class either before or after the marker depending on the value of 'before'.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.

removeConstructor

public void removeConstructor(JotConstructor method)
Removes the specified constructor from the class.

addInitBlock

public JotInitBlock addInitBlock(JotMarker marker,
                                 boolean before,
                                 int mods)
Adds an initialization block to the class and returns an instance of JotInitBlock that represents the block. If 'marker' is not null, then the block will be inserted in the class either before or after the marker depending on the value of 'before'. If the Modifier.STATIC bit of 'mods' is set then the block will be a class initialization block, otherwise the block will be an instance initialization block.

Parameters:
marker - the Jot object relative to which the code is being added
before - controls where, relative to the marker, code will be added. true places the statement before the marker false places the statement after the marker.
mods - What modifier to use as defined by the constants in java.lang.reflect.Modifier.

See Also:
java.lang.reflect.Modifier.

removeInitBlock

public void removeInitBlock(JotInitBlock block)
Removes the specified initialization block from the class.

getComparableLocation

public int getComparableLocation(JotMarker m)
Given a marker in the JotClass, returns a value that can be compared against another marker so as to determine which comes before the other in the source