此内容没有您所选择的语言版本。
6.2. Configuration Properties
If the translator requires configurable properties then:
- define a variable for every property as an attribute in the extended
ExecutionFactory
class, - define "get" and "set" methods for each attribute,
- and annotate each "get" method with
@TranslatorProperty
annotation and provide the metadata about the property.
For example, if you need a property called
foo
, by providing the annotation on these properties, JBoss Data Virtualization will automatically interrogate and provide a graphical way to configure your Translator while designing your VDB.
Only java primitive (
int
, boolean
), primitive object wrapper (java.lang.Integer
), or Enum
types are supported as Translator properties. The default value will be derived from calling the getter, if available, on a newly constructed instance. All properties should have a default value. If there is no applicable default, then the property should be marked in the annotation as required. Initialization will fail if a required property value is not provided.
The
@TranslatorProperty
defines the following metadata that you can define about your property.
- display - the display name of the property.
- description - a description about the property.
- required - specifies that the property is required.
- advanced - an advanced property (a default value must be provided).
- masked - tools need to mask the property, that is, do not show it in plain text. Used for passwords.
Note
A property can not be "advanced" and "required" at the same time.