CloudTran Home

 
  
 
Contents  >   11.  CloudTran Profile Reference
 


11.24 Method Object

Used on
class
entity
javaBean
service
DescriptionThis 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
text (base property)

 11.24.1  Property 'access'
 11.24.2  Property 'description'
 11.24.3  Property 'destroyMethod'
 11.24.4  Property 'initMethod'
 11.24.5  Property 'logReturnValue'
 11.24.6  Property 'name'
 11.24.7  Property 'returnType'
 11.24.8  Property 'synchronized'

11.24.1  Property 'access'
DescriptionSpecifies 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.
TypeString
Choices
<empty> (default)
private
protected
public

11.24.2  Property 'description'
DescriptionOptional description.

Use this to
  1. document the meaning of a particular item
  2. specify functionality at the design stage for implementation later.
TypeString

11.24.3  Property 'destroyMethod'
DescriptionSet 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).
Typeboolean
Defaultfalse

11.24.4  Property 'initMethod'
DescriptionSet 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).
Typeboolean
Defaultfalse

11.24.5  Property 'logReturnValue'
DescriptionThis 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
Typeboolean
Defaultfalse

11.24.6  Property 'name'
DescriptionSpecifies the name of the method.
TypeString
Requiredtrue

11.24.7  Property 'returnType'
DescriptionSpecifies 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.
TypeString
Defaultvoid

11.24.8  Property 'synchronized'
DescriptionThis is the Java 'synchronized' modifier for methods. In C#, it will be turned into 'lock' or 'MethodImplOptions.Synchronized' as appropriate.
Typeboolean
Defaultfalse

Copyright (c) 2001-2011 CloudTran Inc.