Enum QuerydslUtils

    • Method Detail

      • values

        public static QuerydslUtils[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (QuerydslUtils c : QuerydslUtils.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static QuerydslUtils valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • querydslConfiguration

        public static com.querydsl.sql.Configuration querydslConfiguration​(SupportedDatabase databaseType)
        Returns configuration for Querydsl based on the used database type.
      • mapOneToMany

        public static <O,​M> Map<O,​Collection<M>> mapOneToMany​(Collection<com.querydsl.core.Tuple> rawResult,
                                                                          com.querydsl.core.types.Expression<O> onePath,
                                                                          com.querydsl.core.types.Expression<M> manyPath,
                                                                          @Nullable
                                                                          @Nullable BiConsumer<O,​M> manyAccumulator)
        Resolves one-to-many relations between two paths from the Tuple-based result. Returns map with "one" entities as keys (preserving original order) and related "many" entities as a collection in the value for each key.

        Optional accumulator can call further processing on both objects for each "many" item with "one" being internalized to the actual key in the resulting map. This solves the problem when the same entity is represented by different instances. Without this it wouldn't be possible to accumulate "many" in the collection owned by "one".

        Note that proper equals/hashCode must be implemented for <O> type.

        Type Parameters:
        O - type of "one" role
        M - type of "many" role
        Parameters:
        rawResult - collection of tuples, unprocessed result
        onePath - path expression designating "one" role of the relationship
        manyPath - path expression designating "many" role of the relationship
        manyAccumulator - optional, called for each row with respective "one" and "many" items (always the same "one" instance is used for the group matching one key, see details above)
        Returns:
        map of one->[many*] with keys in the original iterating order
      • convertTimestampToPathType

        public static <T extends Comparable<T>> T convertTimestampToPathType​(@NotNull
                                                                             @NotNull Object value,
                                                                             @NotNull
                                                                             @NotNull com.querydsl.core.types.dsl.DateTimePath<T> path)
        Tries to convert value of type type XMLGregorianCalendar to paths of Instant (most likely used), Timestamp and Long.