    001    // Copyright 2014 The Apache Software Foundation
    002    //
    003    // Licensed under the Apache License, Version 2.0 (the "License");
    004    // you may not use this file except in compliance with the License.
    005    // You may obtain a copy of the License at
    006    //
    007    //     http://www.apache.org/licenses/LICENSE-2.0
    008    //
    009    // Unless required by applicable law or agreed to in writing, software
    010    // distributed under the License is distributed on an "AS IS" BASIS,
    011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012    // See the License for the specific language governing permissions and
    013    // limitations under the License.
    014
    015    package org.apache.tapestry5.beaneditor;
    016
    017    import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.BEAN;
    018    import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.COMPONENT;
    019    import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.MIXIN;
    020    import static org.apache.tapestry5.ioc.annotations.AnnotationUseContext.PAGE;
    021
    022    import java.lang.annotation.Documented;
    023    import java.lang.annotation.ElementType;
    024    import java.lang.annotation.Retention;
    025    import java.lang.annotation.RetentionPolicy;
    026    import java.lang.annotation.Target;
    027
    028    import org.apache.tapestry5.ioc.annotations.UseWith;
    029
    030    /**
    031     * Used to explicitly define whether a property should be considerable sortable or not.
    032     * If this annotation isn't used, then the property will be considered sortable only if
    033     * its type implements {@link Comparable}.
    034     * This annotation may be attached to a getter or setter method, or the matching field.
    035     */
    036    @Target({ ElementType.FIELD, ElementType.METHOD })
    037    @Retention(RetentionPolicy.RUNTIME)
    038    @Documented
    039    @UseWith({BEAN,COMPONENT,MIXIN,PAGE})
    040    public @interface Sortable
    041    {
    042        boolean value();
    043    }