Beyond the base issue of inspecting an object and its properties, a number of Inspectors are focused on third-party annotations. These annotation Inspectors all extend BaseObjectInspector, and so inherit its features, but in addition they inspect the following frameworks.
BeanValidationInspector inspects Bean Validation (JSR 303) annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | Bean Validation Annotation |
---|---|
maximum-fractional-digits | @Digits(fraction=...) |
maximum-integer-digits | @Digits(integer=...) |
maximum-length | @Size(max=...) |
maximum-value | @Max |
minimum-length | @Size(min=...) |
minimum-value | @Min |
required | @NotNull |
FacesAnnotationInspector inspects Java Server Faces-specific annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | Annotation |
---|---|
currency-code, currency-symbol, number-uses-grouping-separators, minimum-integer-digits, maximum-integer-digits, minimum-fractional-digits, maximum-fractional-digits, locale, number-pattern and number-type |
@UiFacesNumberConverter - annotates the field should use the standard JSF
NumberConverter.
Note: the NumberConverter property integerOnly is not specified using this annotation, as it can be inferred from the property's type |
date-style, locale, datetime-pattern, time-style, time-zone and datetime-type | @UiFacesDateTimeConverter - annotates the field should use the standard JSF DateTimeConverter |
faces-ajax-event | @UiFacesAjax - annotates the widget for this field should use AJAX in response to the given event |
faces-component |
@UiFacesComponent - annotates the field should be rendered using the
given component type in the UI.
Use of this annotation does not bind the business class to the UI quite as tightly as it may appear, because JSF has a loosely coupled relationship between <component-type> and <component-class>, and a further loose coupling between <component> and <render-kit>, as defined in faces-config.xml |
faces-converter | UiFacesConverter - annotates the field should use the given JSF converter in the UI. This annotation uses the converter id, not its class. Alternatively, this annotation can be an EL expression that evaluates to a javax.faces.convert.Converter instance. |
faces-lookup | @UiFacesLookup - annotates the value in the field should belong to the Collection returned by the given EL expression |
faces-suggest | @UiFacesSuggest - annotates the value in the field should be 'suggested' (i.e. using a pop-up box) using the Collection returned by the given EL expression |
HibernateValidatorInspector inspects Hibernate Validator annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | Hibernate Validator Annotation |
---|---|
maximum-fractional-digits | @Digits(fractionalDigits=...) |
maximum-integer-digits | @Digits(integerDigits=...) |
maximum-length | @Length(max=...) |
maximum-value | @Max |
minimum-length | @Length(min=...) |
minimum-value | @Min |
required | @NotNull or @NotEmpty |
JacksonInspector inspects Jackson annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | Jackson Annotation |
---|---|
hidden | @JsonIgnore |
JaxbInspector inspects Java API for XML Binding (JAXB) annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | JPA Annotation |
---|---|
hidden | @XmlTransient |
required | @XmlElement(required=true) |
JpaInspector inspects Java Persistence API annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | JPA Annotation |
---|---|
hidden | @Id, unless JpaInspectorConfig.setHideIds is false. @Version, unless JpaInspectorConfig.setHideVersions is false. @Transient, unless JpaInspectorConfig.setHideTransients is false. |
large | @Lob |
maximum-length | @Column(length=...) |
required | @Column(nullable=false) or @ManyToOne(optional=false) |
As much as possible, Metawidget tries to inspect metadata from existing sources, without introducing new concepts. Where that is not sufficient, MetawidgetAnnotationInspector adds a handful of annotations:
Metawidget Attribute | Metawidget Annotation |
---|---|
(any) | @UiAttributes and @UiAttribute - a 'catch all' for denoting arbitrary UI metadata |
action | @UiAction |
comes-after | @UiComesAfter |
dont-expand | @UiDontExpand - denotes a value should not be inspected and expanded into sub-widgets. This can be useful if, say, you have a read-only property and just want to display its top-level toString() rather than all its child properties |
hidden | @UiHidden - denotes a value should be hidden in the UI. The value may still be rendered on the client, depending on the Metawidget (i.e. for Web clients, may use a HTML hidden field) |
label | @UiLabel - denotes the label to use in the UI. Can be a resource key if the UI is using resource bundles, or an EL expression if the UI has an expression language (i.e. JSF) |
large | @UiLarge - denotes the field should be 'large' in the UI (i.e. a multi-line textbox) |
lookup | @UiLookup - denotes the value in the field should belong to the given set of Strings |
masked | @UiMasked - denotes a value should be masked in the UI (e.g. a password field) |
read-only | @UiReadOnly - denotes a value should be read-only in the UI |
section | @UiSection - denotes the start of a logical grouping in the UI. Subsequent properties are assumed to belong to the same section until a different section heading is encountered. Sections can be cancelled using a section heading with an empty String. Sections can be nested by specifying an array of section names. |
wide | @UiWide - denotes the field should be 'wide' in the UI, spanning all columns in a multi-column layout. 'Wide' is different to 'large', because 'large' implies a data size (i.e. BLOB or CLOB) whereas 'wide' refers purely to spanning columns. Generally all 'large' fields are implicitly 'wide', but not all 'wide' fields are 'large'. For example, you may want a normal text field (not a text area) to span all columns. |
OvalInspector inspects OVal annotations. It returns the following attributes for the following business properties:
Metawidget Attribute | OVal Annotation |
---|---|
maximum-length | @Length(max=...) or @MaxLength |
maximum-value | @Max or @Range(max=...) |
minimum-length | @Length(min=...) or @MinLength |
minimum-value | @Min or @Range(min=...) |
required | @NotNull or @NotEmpty or @NotBlank |