| java.lang.Object org.netbeans.modules.visualweb.insync.live.ContextMethodHelper
ContextMethodHelper | public class ContextMethodHelper (Code) | | This class provides the implementation for Design time ContextMethod APIs
author: jdeva |
createContextMethod | public boolean createContextMethod(ContextMethod method) throws IllegalArgumentException(Code) | | Creates a new public method in the source code for this DesignContext. The passed
ContextMethod must specify at least the designContext and methodName, and
must not describe a method that already exists in the DesignContext source.
To update an existing method, use the updateContextMethod() method. These
methods are separated to help prevent accidental method overwriting. The following table
details how the specified ContextMethod is used for this method:
designContext | REQUIRED. Must match the DesignContext that is
being called. This is essentially a safety precaution to help prevent accidental
method overwriting.
|
---|
methodName | REQUIRED. Defines the method name.
|
---|
parameterTypes | Defines the parameter types. If null or an empty
array is specified, the created method will have no arguments.
|
---|
parameterNames | Defines the parameter names. If null or an empty
array is specified (or an array shorter than the parameterTypes array), default
argument names will be used.
|
---|
returnType | Defines the return type. If null is specified, the
created method will have a void return type.
|
---|
throwsTypes | Defines the throws clause types. If null is specified,
the created method will have no throws clause.
|
---|
bodySource | Defines the method body Java source code. If null is
specified, the method will have an empty body. If the value is non-null, this must
represent valid (compilable) Java source code.
|
---|
commentText | Defines the comment text above the newly created method. If
null is specified, no comment text will be included.
|
---|
Parameters: method - A ContextMethod object representing the desired public method. true if the method was created successfully, or false ifit was not. throws: IllegalArgumentException - If there was a syntax error in any of the ContextMethodsettings, or if the ContextMethod represents a method that already exists on thisDesignContext (updateContextMethod() must be used in this case to avoidaccidental method overwriting) |
getContextMethod | public ContextMethod getContextMethod(Method m)(Code) | | Returns a
ContextMethod object describing the public method with the specified name
and parameter types. Returns null if no public method exists on this
DesignContext with the specified name and parameter types.
Parameters: methodName - The method name of the desired context method Parameters: parameterTypes - The parameter types of the desired context method A ContextMethod object describing the requested method, or null if nomethod exists with the specified name and parameter types |
getContextMethod | public ContextMethod getContextMethod(String methodName)(Code) | | Returns a
ContextMethod object describing the public method with the specified name
and no arguments. Returns null if no public method exists on this
DesignContext with the specified name and no arguments.
Parameters: methodName - The method name of the desired context method A ContextMethod object describing the requested method, or null if nomethod exists with the specified name and no arguments |
getContextMethod | public ContextMethod getContextMethod(String methodName, Class[] parameterTypes)(Code) | | Returns a
ContextMethod object describing the public method with the specified name
which doesn't take anyparameter types. Returns null if no public method exists on this
DesignContext with the specified name and parameter types.
Parameters: methodName - The method name of the desired context method Parameters: parameterTypes - The parameter types of the desired context method A ContextMethod object describing the requested method, or null if nomethod exists with the specified name and parameter types |
getContextMethods | public ContextMethod[] getContextMethods()(Code) | | Returns a set of
ContextMethod objects describing the public methods declared on this
DesignContext (source file).
An array of ContextMethod objects, describing the public methods declared onthis DesignContext (source file) |
removeContextMethod | public boolean removeContextMethod(ContextMethod method)(Code) | | Removes an existing method from the source code for this DesignContext. The passed
ContextMethod will be used to locate the desired method to remove using the designContext,
methodName, and parameterTypes. No other portions of the ContextMethod are used. The
following table details how the specified ContextMethod is used for this method:
designContext | REQUIRED. Must match the DesignContext that is
being called. This is essentially a safety precaution to help prevent accidental
method removal.
|
---|
methodName | REQUIRED. Specifies the desired method name.
|
---|
parameterTypes | REQUIRED. Specifies the desired method's
parameter types (if it has any). If null or an empty array is
specified, the desired method is assumed to have zero arguments.
|
---|
parameterNames | Ignored.
|
---|
returnType | Ignored.
|
---|
throwsTypes | Ignored.
|
---|
bodySource | Ignored.
|
---|
commentText | Ignored.
|
---|
Parameters: method - A ContextMethod object defining the method to be removed true if the method was successfully removed exception: IllegalArgumentException - if the specified ContextMethod does not exist or is notpublic on this DesignContext |
updateContextMethod | public ContextMethod updateContextMethod(ContextMethod method) throws IllegalArgumentException(Code) | | Updates an existing public method in the source code for this DesignContext. The passed
ContextMethod will be used to locate the desired public method to update using the
designContext, methodName, and parameterTypes. This method may only be used to update the
parameterNames, returnType, throwsTypes, bodySource, or commentText. Any other changes
actually constitute the creation of a new method, as they alter the method signature. To
create a new method, the createContextMethod() method should be used. These
operations are separated to help prevent accidental method overwriting. The following table
details how the specified ContextMethod is used for this method:
designContext | REQUIRED. Must match the DesignContext that is
being called. This is essentially a safety precaution to help prevent accidental
method overwriting.
|
---|
methodName | REQUIRED. Specifies the desired method name.
|
---|
parameterTypes | REQUIRED. Specifies the desired method's
parameter types (if it has any). If null or an empty array is
specified, the desired method is assumed to have zero arguments.
|
---|
parameterNames | Defines the parameter names. If null or an empty
array is specified (or an array shorter than the parameterTypes array), default
argument names will be used.
|
---|
returnType | Defines the method's return type. If null is specified,
the method is assumed to have a void return type.
|
---|
throwsTypes | Defines the throws clause types. If null is specified,
the resulting method will have no throws clause.
|
---|
bodySource | Defines the method body Java source code. If null is
specified, the resulting method body will be empty. If the value is non-null, this
must represent valid (compilable) Java source code. Note that a method with a
non-void return type must return a value.
|
---|
commentText | Defines the comment text above the newly created method. If
null is specified, no comment text will be included.
|
---|
Parameters: method - The desired ContextMethod representing the method to be updated The resulting ContextMethod object (including any updates from the process) throws: IllegalArgumentException - If there was a syntax error in any of the ContextMethodsettings, or if the ContextMethod does not exist in this DesignContext. |
|
|