# Enhancements in Sapphire 8.2

1. Length Constraints
2. Color

## Length Constraints

The new @Length annotation allows min and max constraints to be specified for the text length of a value property or the item count of a list property. It replaces the now deprecated @CountConstraint annotation that applies only to list properties.

    // *** Comment ***

    @Length( max = 500 )

    ValueProperty PROP_COMMENT = new ValueProperty( TYPE, "Comment" );

    Value<String> getComment();
    void setComment( String value );

    // *** Entries ***

    @Type( base = PurchaseOrderEntry.class )
    @Length( min = 1, max = 100 )

    ListProperty PROP_ENTRIES = new ListProperty( TYPE, "Entries" );

    ElementList<PurchaseOrderEntry> getEntries();

If the maximum length is specified and the text field property editor presentation is used, capacity feedback is displayed beneath the text field.

## Color

The Color class can now be directly constructed from #RRGGBB string representation.

    public final class Color
    {
        /**
         * Creates a new color object from a string in #RRGGBB format, where RR, GG and BB are hex numbers
         * from 00 to FF corresponding to red, green and blue components of the color.
         *
         * @param color a string representation of a color
         * @throws IllegalArgumentException if the color string is null or is not of the expected format
         * @since 8.2
         */

        public Color( String color )

        /**
         * Creates a new color object.
         *
         * @param red the value of the red channel, between 0 and 255
         * @param green the value of the green channel, between 0 and 255
         * @param blue the value of the blue channel, between 0 and 255
         * @throws IllegalArgumentException if a channel value is not within range
         */

        public Color( int red, int green, int blue )

    }

Copyright (c) 2016 Oracle
Content made available under the terms of Eclipse Public License.