Where Am I? Class Hierarchy All Classes All Fields and Methods

Interface com.ibm.ivj.util.builders.BuilderFactory

public interface BuilderFactory


Method Index

createMethodBuilder(String)
Construct a Method builder
createTypeBuilder(String, Package)
Construct a Type builder for a new type.
createTypeBuilder(Type)
Construct a Type builder for an existing Type.
createUserCodeBlock(String, String)
This is a convenience method.

Methods

createMethodBuilder
 public abstract MethodBuilder createMethodBuilder(String builderName) throws IllegalArgumentException
Construct a Method builder

Parameters:
name - java.lang.String For method builders constructed using this factory method, the supplied name is strictly used for programmer convenience in identifying the individual method builders. The actual method name used in TypeBuilder calls (eg. save(), getExistingMethodSource(...)) is determined based on the supplied method source (setSource(...)). It is recommended that name be in fact specified in the form of a unique Java method signature.
builderName - java.lang.String
Returns:
com.ibm.ivj.util.builders.MethodBuilder
createTypeBuilder
 public abstract TypeBuilder createTypeBuilder(Type type) throws IvjException, IllegalArgumentException
Construct a Type builder for an existing Type. The specified type must be loaded in the workspace.

Parameters:
type - com.ibm.ivj.util.base.Type
Returns:
com.ibm.ivj.util.builders.TypeBuilder
createTypeBuilder
 public abstract TypeBuilder createTypeBuilder(String name,
                                               Package parent) throws IvjException, IllegalArgumentException
Construct a Type builder for a new type. The specified type must not exist in the workspace.

Parameters:
name - java.lang.String
parent - com.ibm.ivj.util.base.Package
Returns:
com.ibm.ivj.util.builders.TypeBuilder
createUserCodeBlock
 public abstract String createUserCodeBlock(String identifier,
                                            String indent)
This is a convenience method. It returns a code block marked as a user block. This method can be used when generating code that is expected to be augmented by the users, but will also be subsequently regenerated. A user block defines a segment of the generated code where users can safely make changes that will not be lost when the method is regenerated. In the generated source code a user block appears as a section of code delimited by structured comments. User blocks are associated with an identifier. The identifier is used during source merging to determine which user modification are to be inserted at what point in the new code. A typical use scenario in defining method source would be
 String code;
 Workspace ws;
 BuilderFactory bf;
 ws = ToolEnv.connectToWorkspace();
 bf = ws.createBuilderFactory;
 code =        "public static void main(String args[]) {\n";
 code = code + "\t... generated code ...\n";
 code = code + bf.createUserCodeBlock("1","\t");
 code = code + "}";
 
Note, that source code containing user blocks is only merged with user changes when TypeBuilder.saveMerge() is called. Calling TypeBuilder.save() will only save the code and any empty user blocks.

Parameters:
identifier - java.lang.String block user block identifier. This is a unique identifier for the block.
indent - java.lang.String indentation string. The supplied string (if any) is prepended to the user block comment markers. This allows the markers to be aligned with respect to the rest of the generated code. Typically the string will contain some number of spaces or tabs.
Returns:
java.lang.String

Where Am I? Class Hierarchy All Classes All Fields and Methods