11.24 Method Object
| Used on |
|
| Description | This is a Java 'method' on steroids. As well as parameters and exceptions, this method and its parameters can have constraints
It is used for the internal implementation logic of a class. This method is distinct from the business method because it does not have the notion of "exposing to users".
Additional Information:
In GigaSpaces, a method can also be marked with the initMethod, lastInitMethod and destroyMethod flags.
|
Contained Lists |
| 1 |
| Name | annotation |
| Type | String |
| Description | An optional list, comma-separated, of Java annotations.
You can put the '@' as the first character on the annotation, but it is not necessary.
You can add the annotation as either
- an XML element, with the CDATA being the annotation text
- a property which can contain multiple annotations, comma-separated.
If you use the property form, you cannot add multiple element-pair values as the syntax conflicts with the comma-separation syntax.
In other words, annotation="@Annotation(id=27,name='Fred')" will be parsed into two separate annotations,
and then inserted into the code as "@Annotation(id=27" and "@name='Fred')", which is incorrect syntax.
Because of this, some modelling environments allow annotations to be added as a property (this is most convenient) and as a list (this allows complex annotations).
|
| Unique | false |
|
| |
| 2 |
| Name | parameter |
| Type | parameter
|
| Description | This overrides the parameter list from the Java meta-model, so we get business-object level parameters.
|
| Indexed property | name |
|
| |
| 3 |
| Name | exception |
| Type | String |
| Description | Defines the exception(s) thrown by the method.
In the Eclips editor, multiple thrown exceptions may be specified in the 'exception' property using a comma separated list.
In XML, you can use one or more <exception> nested elements as an alternative to the 'exception=' property.
Any duplicate exceptions are ignored.
|
| Unique | false |
|
| |
| 4 |
| Name | typeParameter |
| Type | typeParameter
|
| Description | A list of type-parameters on the method. For example, in the definition in Java 5 arrays:
static <T> List<T> asList( T... a )
the first <T> would be represented by a type-parameter list with one TypeParameter entry - name="T", and no extends.
In the Java Language Specification (JLS),
a type parameter is also referred to as "type variable", and this list is referred to as the "formal type parameters" for the method.
They need not be provided explicitly when a generic method is invoked. Instead, they are almost always inferred.
By definition, a method is generic if there are one or more type parameters.
The parameters specified here are used to generate the method declaration.
|
| GenerateAllList | false |
|
|
Inherited properties |
|
11.24.1 Property 'access'
|
| Description | Specifies the access control for the attribute.
The default access is specifically null, so that there is no access control value placed in the code.
This is necessary because the default for the access changes depending on the context.
|
| Type | String |
| Choices |
| <empty> (default) |
| private |
| protected |
| public |
|
11.24.2 Property 'description'
|
| Description | Optional description.
Use this to
- document the meaning of a particular item
- specify functionality at the design stage for implementation later.
|
| Type | String |
11.24.3 Property 'destroyMethod'
|
| Description | Set this to true to make this method the destroyMethod for the service.
An destroyMethod using the default name for the destroy method can be created
by setting the 'generateDestroyMethod' flag in the parent 'service' object.
This must not be set on an abstract class because that cannot be instantiated (in order to inject an instance into the PU).
|
| Type | boolean |
| Default | false |
11.24.4 Property 'initMethod'
|
| Description | Set this to true to make this method the initMethod for the bean or class.
An initMethod is initiated as the containing processing unit is started (before any services or spaces are guaranteed to be available)
and should therefore be used only for local processing.
An initMethod using the default name for the init method can be created
by setting the 'generateInitMethod' flag in the parent 'service' object.
This must not be set on an abstract class because that cannot be instantiated (in order to inject an instance into the PU).
|
| Type | boolean |
| Default | false |
11.24.5 Property 'logReturnValue'
|
| Description | This tells the generator to generate a wrapper for the method that
- declares a 'returnValue' variable, in the wrapper, with a null value appropriate to the type
- lets the programmer set it in the business logic
- logs the returned value at detailed debug level
- then returns the value as the returnValue of the method.
So, instead of saying e.g. "return 1", the programmer writes "returnValue = 1"
and the generated wrapper will log this value and then return it as the result of the method.
This flag does not have any effect for void methods.
This is a delegated flag and is present on methods, classes, jars and applications.
An overall default for the complete application can be set by defining a value in the system.properties for an application
(using $booleanTrue or $booleanFalse) for
|
| Type | boolean |
| Default | false |
11.24.6 Property 'name'
|
| Description | Specifies the name of the method.
|
| Type | String |
| Required | true |
11.24.7 Property 'returnType'
|
| Description | Specifies the method's return type. The default is 'void'.
For value-returning methods, the return type may be any primitive type or interface/class name,
whether alone or qualified by a package name.
|
| Type | String |
| Default | void |
11.24.8 Property 'synchronized'
|
| Description | This is the Java 'synchronized' modifier for methods. In C#, it will be turned into 'lock' or 'MethodImplOptions.Synchronized' as appropriate.
|
| Type | boolean |
| Default | false |
|