to.etc.domui.component.meta
Interface PropertyMetaModel<T>

All Superinterfaces:
IValueAccessor<T>, IValueTransformer<T>
All Known Implementing Classes:
DefaultPropertyMetaModel, ExpandedDisplayProperty, ExpandedDisplayPropertyList, JoinedDisplayProperty, PathPropertyMetaModel, PropertyMetaModelWrapper

public interface PropertyMetaModel<T>
extends IValueAccessor<T>

Contains the metadata that is known for a field (property). Since the future of first-class Java properties is unclear (they would be way too helpful so naturally they get little attention) this uses class/string encoding to represent a property.

Author:
Frits Jalvingh Created on Jun 16, 2008

Method Summary
 java.lang.Class<T> getActualType()
          Returns the actual type of the property's value.
<A> A
getAnnotation(java.lang.Class<A> annclass)
          If the property has some kind of "annotation" (which in here does not need to be a Java annotation, but which can also be some other java class containing data) this returns it.
 java.util.List<java.lang.Object> getAnnotations()
          If the property has some kind of "annotations" (which in here does not need to be a Java annotation, but which can also be some other java class containing data) this returns all of them.
 ClassMetaModel getClassModel()
          The ClassModel that this property is a property of.
 java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
          If this should be represented by a combo this can be set to represent the default combo dataset.
 java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
          For a relation, this is the list of properties that should be shown.
 java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
          When this relation-property is presented as a single field this can contain a class to render that field as a string.
 java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
          When set this renderer should be used to render the nodes in the combobox.
 java.lang.String getComponentTypeHint()
          When present this gives a hint to the component factories to help with choosing a proper component to select a single record of the type specified by this property.
 ControlFactory getControlFactory()
          If a specific control factory is to be used to create controls for this item this returns that factory.
 IConverter<T> getConverter()
          Returns the user-specified converter to use when converting this property's value to and from string.
 java.lang.String getDefaultHint()
          Returns the default hint text (which pops up when the mouse is held over the control that inputs this item).
 java.lang.String getDefaultLabel()
          Return any default label (the text to use before the control that inputs this property) for this property.
 int getDisplayLength()
          Returns the #chars to be displayed by default for this item.
 java.lang.String getDomainValueLabel(java.util.Locale loc, java.lang.Object val)
          Retrieves the properly localized string representing a domain value in a type which has a fixed set of domain values (like enum or boolean).
 java.lang.Object[] getDomainValues()
          If the type for this property has a fixed set of domain values (like boolean or enum) this contains all possible values for this property.
 java.lang.String[][] getEditRoles()
          Defines the roles that a user must have to edit this field.
 java.lang.reflect.Type getGenericActualType()
          The abomination that is Java Generics requires a separate dysfunctional type system to represent generic typing, at the few places it is available.
 int getLength()
          Return the defined length for the item PROVIDED IT WAS SET - THIS SUFFERS FROM AN UTTER FUCKUP IN THE JPA "STANDARD".
 java.util.List<SearchPropertyMetaModel> getLookupFieldKeySearchProperties()
          When used in a LookupInput field, this fields are used to create the keyword search inputs.
 java.util.List<SearchPropertyMetaModel> getLookupFieldSearchProperties()
          When used in a LookupInput field, this fields are used to create the search inputs.
 java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.
 java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page.
 java.util.List<DisplayPropertyMetaModel> getLookupTableProperties()
          When used in a LookupInput field, this fields are used to show the result of a Search in the DataTable.
 java.lang.String getName()
          Returns the name of the property.
 NumericPresentation getNumericPresentation()
          Used for numeric types, this returns how to present the number and defines the number's class, like a monetary amount.
 int getPrecision()
          Return the specified precision of the numeric field.
 YesNoType getReadOnly()
          Reports whether a property is readonly.
 java.lang.String getRegexpUserString()
          Use the string to use as the pattern indicator in regexp-validator error messages.
 java.lang.String getRegexpValidator()
          Returns the regexp to use to validate input.
 PropertyRelationType getRelationType()
          Tells if this property represents some kind of database relation (a "parent" property referring to the master of this child record, or a property representing the list of children).
 int getScale()
          For numeric types, this returns any defined scale.
 SortableType getSortable()
          Returns whether the property should be sortable when used in a default table, and defines the initial sort direction of the property.
 TemporalPresentationType getTemporal()
          If this is defined as some Date type this further defines the domain (date only, date time etc).
 PropertyMetaValidator[] getValidators()
          Get all validators to run on this property's input after conversion.
 ClassMetaModel getValueModel()
          If applicable, the value type's class model.
 java.lang.String[][] getViewRoles()
          If this contains null the field can be seen by all users.
 boolean isPrimaryKey()
          Returns T if we know this property to be the PK.
 boolean isRequired()
          Whether the property is defined as requiring a value.
 boolean isTransient()
          If marked as transient in the persistent class this returns true
 
Methods inherited from interface to.etc.domui.util.IValueAccessor
setValue
 
Methods inherited from interface to.etc.domui.util.IValueTransformer
getValue
 

Method Detail

getClassModel

@Nonnull
ClassMetaModel getClassModel()
The ClassModel that this property is a property of.

Returns:

getValueModel

@Nullable
ClassMetaModel getValueModel()
If applicable, the value type's class model. Can be asked for explicitly to allow for non-class-based metamodels. It will return null for all primitive and basic types.

Returns:

getActualType

@Nonnull
java.lang.Class<T> getActualType()
Returns the actual type of the property's value. This is the return type of the getter function.

Returns:

getGenericActualType

@Nullable
java.lang.reflect.Type getGenericActualType()
The abomination that is Java Generics requires a separate dysfunctional type system to represent generic typing, at the few places it is available. This returns the generic type information that is present on whatever type is the return type. This CAN return NULL!!!

Returns:

getDefaultLabel

@Nullable
java.lang.String getDefaultLabel()
Return any default label (the text to use before the control that inputs this property) for this property. The default label is obtained from the resource file with the same location and name as the class file containing the property after doing NLS language replacement; the label text is looked up in that file as 'propertyname.label='. The code uses the "current" locale as set in NlsContext to lookup the proper resource file.

Returns:
the label text, or null if unknown.

getDefaultHint

@Nullable
java.lang.String getDefaultHint()
Returns the default hint text (which pops up when the mouse is held over the control that inputs this item). The hint text is a single, short, line of text. Like the default label this gets looked up in the resource file for the class this is a property of. The property that is looked up is 'propertyname.hint'.

Returns:
The hint text, or null if not known.

getLength

int getLength()
Return the defined length for the item PROVIDED IT WAS SET - THIS SUFFERS FROM AN UTTER FUCKUP IN THE JPA "STANDARD". This is valid for string-type fields mostly, and should hold the size defined in the database. This field is usually set from the @Column annotation specified. But since that annotation was written by an idiot with a brain the size of a pea the "default" value for the length field in that annotation is set to 255. Since 255 is a valid length value this makes it impossible to determine if the actual length IS 255, or that the user did not provide a value and we need to calculate one ourselves.

Returns:
The size in characters of this item, or -1 if unknown.

getPrecision

int getPrecision()
Return the specified precision of the numeric field. Returns -1 if not known or not numeric.

Returns:
the precision, or -1 if unknown. The precision is the total #of digits present in the number, including scale digits.

getScale

int getScale()
For numeric types, this returns any defined scale. If undefined this returns -1.

Returns:

getDisplayLength

int getDisplayLength()
Returns the #chars to be displayed by default for this item. When present this overrides the length or precision as a size indicator.

Returns:

getName

@Nonnull
java.lang.String getName()
Returns the name of the property.

Returns:

getSortable

@Nonnull
SortableType getSortable()
Returns whether the property should be sortable when used in a default table, and defines the initial sort direction of the property. This defaults to unsortable.

Returns:

getConverter

@Nullable
IConverter<T> getConverter()
Returns the user-specified converter to use when converting this property's value to and from string. Can be null.

Returns:

isRequired

boolean isRequired()
Whether the property is defined as requiring a value.

Returns:

isPrimaryKey

boolean isPrimaryKey()
Returns T if we know this property to be the PK.

Returns:

getRelationType

@Nonnull
PropertyRelationType getRelationType()
Tells if this property represents some kind of database relation (a "parent" property referring to the master of this child record, or a property representing the list of children).

Returns:

getDomainValues

@Nullable
java.lang.Object[] getDomainValues()
If the type for this property has a fixed set of domain values (like boolean or enum) this contains all possible values for this property. So this will contain the actual enum labels or the constants Boolean.TRUE and Boolean.FALSE. It returns null for other domains.

Returns:

getDomainValueLabel

@Nullable
java.lang.String getDomainValueLabel(java.util.Locale loc,
                                              java.lang.Object val)
Retrieves the properly localized string representing a domain value in a type which has a fixed set of domain values (like enum or boolean). So for instance passing in an english locale and the constant Boolean.TRUE this could return "yes". The translated value is obtained by first looking up a translation in the base class's properties file; if it is undefined there it will be looked up in the enum's property file. If a proper representation cannot be found this will return a toString on the value.

Parameters:
loc -
val -
Returns:

getTemporal

@Nonnull
TemporalPresentationType getTemporal()
If this is defined as some Date type this further defines the domain (date only, date time etc).

Returns:

getNumericPresentation

@Nonnull
NumericPresentation getNumericPresentation()
Used for numeric types, this returns how to present the number and defines the number's class, like a monetary amount. This gets overridden when a converter is set!

Returns:

getComboDataSet

@Nullable
java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
If this should be represented by a combo this can be set to represent the default combo dataset.

Returns:

getComboLabelRenderer

@Nullable
java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
When this relation-property is presented as a single field this can contain a class to render that field as a string.

Returns:

getComboNodeRenderer

@Nullable
java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
When set this renderer should be used to render the nodes in the combobox.

Returns:

getComboDisplayProperties

@Nonnull
java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
For a relation, this is the list of properties that should be shown. This is needed ONLY when the class metadata of the parent record does not specify a default display column or columnset.

Returns:

getViewRoles

@Nullable
java.lang.String[][] getViewRoles()
If this contains null the field can be seen by all users. If it has a value the first-level array is a set of ORs; the second level are ANDs. Meaning that an array in the format:
 { {"admin"}
 , {"editroles", "user"}
 , {"tester"}
 };
 
this means that the field is visible for a user with the roles:
        "admin" OR "tester" OR ("editroles" AND "user")
 

Returns:

getEditRoles

@Nullable
java.lang.String[][] getEditRoles()
Defines the roles that a user must have to edit this field. See the description at getViewRoles() for details.

Returns:

getReadOnly

@Nonnull
YesNoType getReadOnly()
Reports whether a property is readonly. For Java classes a property is defined as readOnly when it has no "setter" method.

Returns:

isTransient

boolean isTransient()
If marked as transient in the persistent class this returns true


getComponentTypeHint

@Nullable
java.lang.String getComponentTypeHint()
When present this gives a hint to the component factories to help with choosing a proper component to select a single record of the type specified by this property. This is only used when this property points to a parent in an UP relation, and the child needs to add a control to help it select one parent.

Returns:

getLookupSelectedRenderer

@Nullable
java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page. If empty this will use the lookupFieldDisplayProperties.

Returns:

getLookupSelectedProperties

@Nonnull
java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.

Returns:

getLookupTableProperties

@Nonnull
java.util.List<DisplayPropertyMetaModel> getLookupTableProperties()
When used in a LookupInput field, this fields are used to show the result of a Search in the DataTable.

Returns:

getLookupFieldSearchProperties

@Nonnull
java.util.List<SearchPropertyMetaModel> getLookupFieldSearchProperties()
When used in a LookupInput field, this fields are used to create the search inputs.

Returns:

getLookupFieldKeySearchProperties

@Nonnull
java.util.List<SearchPropertyMetaModel> getLookupFieldKeySearchProperties()
When used in a LookupInput field, this fields are used to create the keyword search inputs.

Returns:

getValidators

@Nullable
PropertyMetaValidator[] getValidators()
Get all validators to run on this property's input after conversion.

Returns:

getRegexpValidator

@Nullable
java.lang.String getRegexpValidator()
Returns the regexp to use to validate input.

Returns:

getRegexpUserString

@Nullable
java.lang.String getRegexpUserString()
Use the string to use as the pattern indicator in regexp-validator error messages.

Returns:

getControlFactory

@Nullable
ControlFactory getControlFactory()
If a specific control factory is to be used to create controls for this item this returns that factory.

Returns:

getAnnotation

@Nullable
<A> A getAnnotation(@Nonnull
                             java.lang.Class<A> annclass)
If the property has some kind of "annotation" (which in here does not need to be a Java annotation, but which can also be some other java class containing data) this returns it.

Type Parameters:
A -
Parameters:
annclass -
Returns:

getAnnotations

@Nonnull
java.util.List<java.lang.Object> getAnnotations()
If the property has some kind of "annotations" (which in here does not need to be a Java annotation, but which can also be some other java class containing data) this returns all of them.

Returns: