Class Annotations


  • public class Annotations
    extends Object
    A factory class to create restrictions based on annotation values.
    Version:
    2.0
    Author:
    Nicklas
    • Constructor Detail

      • Annotations

        public Annotations()
    • Method Detail

      • expression

        public static Expression expression​(AnnotationType annotationType)
        Create an expression representing the value of an annotation to the root item of the query. This method works best with single-valued annotation types. It can generate duplicate result rows for the same entity for multi-valued annotations.
        Parameters:
        annotationType - The annotation type to generate an expression for
        Returns:
        An expression
        Throws:
        InvalidDataException - If the annotationType is null
        Since:
        3.2
      • expression

        public static Expression expression​(String alias,
                                            AnnotationType annotationType)
        Create an expression representing the value of an annotation to a joined item of the query. This method works best with single-valued annotation types. It can generate duplicate result rows for the same entity for multi-valued annotations.
        Parameters:
        alias - The alias of a joined item or null to use the root item
        annotationType - The annotation type to generate an expression for
        Returns:
        An expression
        Throws:
        InvalidDataException - If the annotationType is null
        Since:
        3.2
      • innerJoin

        public static Join innerJoin​(AnnotationType annotationType,
                                     String joinedAlias)
        Create an inner join between the root element of a query and the annotation values for the given annotation type.
        Parameters:
        annotationType - The annotation type to to join
        joinedAlias - The alias to use for the joined annotation values
        Returns:
        A join query element
        Throws:
        InvalidDataException - If the annotationType or joinedAlias is null
        Since:
        3.2
      • innerJoin

        public static Join innerJoin​(String alias,
                                     AnnotationType annotationType,
                                     String joinedAlias)
        Create an inner join between an already joined element of a query and the annotation values for the given annotation type.
        Parameters:
        alias - The alias of a joined item or null to use the root item
        annotationType - The annotation type to to join
        joinedAlias - The alias to use for the joined annotation values
        Returns:
        A join query element
        Throws:
        InvalidDataException - If the annotationType or joinedAlias is null
        Since:
        3.2
      • leftJoin

        public static Join leftJoin​(AnnotationType annotationType,
                                    String joinedAlias)
        Create a left join between the root element of a query and the annotation values for the given annotation type.
        Parameters:
        annotationType - The annotation type to to join
        joinedAlias - The alias to use for the joined annotation values
        Returns:
        A join query element
        Throws:
        InvalidDataException - If the annotationType or joinedAlias is null
        Since:
        3.3
      • leftJoin

        public static Join leftJoin​(String alias,
                                    AnnotationType annotationType,
                                    String joinedAlias)
        Create a left join between an already joined element of a query and the annotation values for the given annotation type.
        Parameters:
        alias - The alias of a joined item or null to use the root item
        annotationType - The annotation type to to join
        joinedAlias - The alias to use for the joined annotation values
        Returns:
        A join query element
        Throws:
        InvalidDataException - If the annotationType or joinedAlias is null
        Since:
        3.2