7.12 InterfaceField Object
| Used on |
|
| Description | A field on a interface.
|
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 |
|
|
Inherited properties |
| template |
(base property)
| |
| text |
(base property)
| |
| jwpattern |
(base property)
| |
|
7.12.1 Property 'default'
|
| Description | Specifies a default value to which the field will be set when created.
This is an expression which should be compatible with the field's 'type', or the generated program will not compile.
For primitive types, this will typically be just the literal value of the default, although it can be an expression.
Note that you should just specify the value part for numeric values, not a type-defining suffix.
For example, you must specify "0" rather that "0L".
For non-string objects, the default should create an object - e.g. 'new Integer(8)'.
String defaults are assumed to be string literals less the surrounding "".
They will have double-quotes added automatically, so the default is a String constant - e.g. Fred goes into the code as "Fred".
You can alter this action, to specify expressions for string defaults, by prefixing the expression with '\', which will be stripped off.
You can also start and end the default string value with '"', in which case it will not be altered.
String examples:
input: Fred
code: "Fred"
input: \otherfield.substring(1)
code: otherfield.substring(1)
input: \""
code: ""
The default expression as processed by the above algorithm can be retrieved via the method getDefaultExpression().
|
| Type | String |
7.12.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 |
7.12.3 Property 'name'
|
| Description | Specifies the identifier for the field or parameter. This must follow the rules for identifiers (start with a letter or '_', not include '.' etc.).
|
| Type | String |
| Required | true |
7.12.4 Property 'type'
|
| Description | Specifies the object type and may be the name of a primitive type or a class.
If the type is a class and the code requires you to qualify it (because it is ambiguous in one or more compiled files) you will have to add the qualifying package information yourself.
To specify an array, add '[]' on the end of the type, just as you would in a normal array declaration.
|
| Type | String |
| Default | String |
|