Class PropertyDefinition<T>

    • Constructor Detail

    • Method Detail

      • accept

        public abstract <R,​P> R accept​(PropertyDefinitionVisitor<R,​P> v,
                                             P p)
        Apply a visitor to this property definition.
        Type Parameters:
        R - The return type of the visitor's methods.
        P - The type of the additional parameters to the visitor's methods.
        Parameters:
        v - The property definition visitor.
        p - Optional additional visitor parameter.
        Returns:
        Returns a result as specified by the visitor.
      • accept

        public abstract <R,​P> R accept​(PropertyValueVisitor<R,​P> v,
                                             ValueOrExpression<T> value,
                                             P p)
        Apply a visitor to a property value associated with this property definition.
        Type Parameters:
        R - The return type of the visitor's methods.
        P - The type of the additional parameters to the visitor's methods.
        Parameters:
        v - The property value visitor.
        value - The property value.
        p - Optional additional visitor parameter.
        Returns:
        Returns a result as specified by the visitor.
      • compare

        public final int compare​(ValueOrExpression<T> o1,
                                 ValueOrExpression<T> o2)
        Compares two property values for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
        Specified by:
        compare in interface Comparator<T>
        Parameters:
        o1 - the first object to be compared.
        o2 - the second object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      • getValueComparator

        public final Comparator<T> getValueComparator()
        Returns a comparator for the value type.
        Returns:
        a comparator
      • compareTo

        public final int compareTo​(PropertyDefinition<?> o)
        Compares this property definition with the specified property definition for order. Returns a negative integer, zero, or a positive integer if this property definition is less than, equal to, or greater than the specified property definition.

        The ordering must be determined first from the property name and then base on the underlying value type.

        Specified by:
        compareTo in interface Comparable<T>
        Parameters:
        o - The reference property definition with which to compare.
        Returns:
        Returns a negative integer, zero, or a positive integer if this property definition is less than, equal to, or greater than the specified property definition.
      • decodeValueOrExpression

        public final ValueOrExpression<T> decodeValueOrExpression​(String value)
        Parse and validate a string representation of a property value ot expression.
        Parameters:
        value - The property string value or expression (must not be null).
        Returns:
        Returns the decoded property value or expression.
        Throws:
        PropertyException - If the property value or expression string is invalid.
      • decodeValue

        public final ValueOrExpression<T> decodeValue​(String value)
        Parse and validate a string representation of a property value.
        Parameters:
        value - The property string value (must not be null).
        Returns:
        Returns the decoded property value.
        Throws:
        PropertyException - If the property value string is invalid.
      • encodeValue

        public final String encodeValue​(ValueOrExpression<T> value)
        Encode the provided property value into its string representation.

        This default implementation simply returns invokes the Object.toString() method on the provided value.

        Parameters:
        value - The property value (must not be null).
        Returns:
        Returns the encoded property string value.
        Throws:
        PropertyException - If the property value is invalid.
      • equals

        public final boolean equals​(Object o)
        Indicates whether some other object is "equal to" this property definition. This method must obey the general contract of Object.equals(Object). Additionally, this method can return true only if the specified Object is also a property definition and it has the same name, as returned by getName(), and also is deemed to be "compatible" with this property definition. Compatibility means that the two property definitions share the same underlying value type and provide similar comparator implementations.
        Specified by:
        equals in interface Comparator<T>
        Overrides:
        equals in class Object
        Parameters:
        o - The reference object with which to compare.
        Returns:
        Returns true only if the specified object is also a property definition and it has the same name and is compatible with this property definition.
        See Also:
        Object.equals(java.lang.Object), Object.hashCode()
      • getAdministratorAction

        public final AdministratorAction getAdministratorAction()
        Get the administrator action associated with this property definition. The administrator action describes any action which the administrator must perform in order for changes to this property to take effect.
        Returns:
        Returns the administrator action associated with this property definition.
      • getDefaultBehaviorProvider

        public final DefaultBehaviorProvider<ValueOrExpression<T>> getDefaultBehaviorProvider()
        Get the default behavior provider associated with this property definition.
        Returns:
        Returns the default behavior provider associated with this property definition.
      • getDescription

        public final LocalizableMessage getDescription()
        Gets the optional description of this property definition in the default locale.
        Returns:
        Returns the description of this property definition in the default locale, or null if there is no description.
      • getDescription

        public final LocalizableMessage getDescription​(Locale locale)
        Gets the optional description of this property definition in the specified locale.
        Parameters:
        locale - The locale.
        Returns:
        Returns the description of this property definition in the specified locale, or null if there is no description.
      • getManagedObjectDefinition

        public final AbstractManagedObjectDefinition<?,​?> getManagedObjectDefinition()
        Gets the managed object definition associated with this property definition.
        Returns:
        Returns the managed object definition associated with this property definition.
      • getName

        public final String getName()
        Get the name of the property.
        Returns:
        Returns the name of the property.
      • getSynopsis

        public final LocalizableMessage getSynopsis()
        Gets the synopsis of this property definition in the default locale.
        Returns:
        Returns the synopsis of this property definition in the default locale.
      • getSynopsis

        public final LocalizableMessage getSynopsis​(Locale locale)
        Gets the synopsis of this property definition in the specified locale.
        Parameters:
        locale - The locale.
        Returns:
        Returns the synopsis of this property definition in the specified locale.
      • getDeprecated

        public final Deprecated getDeprecated()
        Get deprecation definition of property definition.
        Returns:
        Returns a deprecated definition of this managed object definition.
      • hashCode

        public final int hashCode()
        Returns a hash code value for this property definition. The hash code should be derived from the property name and the type of values handled by this property definition.
        Overrides:
        hashCode in class Object
        Returns:
        Returns the hash code value for this property definition.
      • hasOption

        public final boolean hasOption​(PropertyOption option)
        Check if the specified option is set for this property definition.
        Parameters:
        option - The option to test.
        Returns:
        Returns true if the option is set, or false otherwise.
      • normalizeValue

        public final String normalizeValue​(ValueOrExpression<T> valueOrExpression)
        Get a normalized string representation of a property value. This can then be used for comparisons and for generating hash-codes.

        This method may throw an exception if the provided value is invalid. However, applications should not assume that implementations of this method will always validate a value. This task is the responsibility of validateValue(ValueOrExpression).

        This default implementation simply returns the string representation of the provided value. Sub-classes might want to override this method if this behavior is insufficient (for example, a string property definition might strip white-space and convert characters to lower-case).

        Parameters:
        valueOrExpression - The property value to be normalized.
        Returns:
        Returns the normalized property value.
        Throws:
        PropertyException - If the property value is invalid.
      • toString

        public final String toString()
        Returns a string representation of this property definition.
        Overrides:
        toString in class Object
        Returns:
        Returns a string representation of this property definition.
        See Also:
        Object.toString()
      • toString

        public void toString​(StringBuilder builder)
        Append a string representation of the property definition to the provided string builder.

        This simple implementation just outputs the propertyName of the property definition. Sub-classes should override this method to provide more complete string representations.

        Parameters:
        builder - The string builder where the string representation should be appended.
      • validateValue

        public final void validateValue​(ValueOrExpression<T> valueOrExpression)
        Determine if the provided property value is valid according to this property definition.
        Parameters:
        valueOrExpression - The property value (must not be null).
        Throws:
        PropertyException - If the property value is invalid.
      • initialize

        protected void initialize()
                           throws Exception
        Performs any run-time initialization required by this property definition. This may include resolving managed object paths and property names.
        Throws:
        Exception - If this property definition could not be initialized.