Class Fields


  • public final class Fields
    extends java.lang.Object
    Utility class for Field.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​R>
      Field<R>
      apply​(java.util.function.BiFunction<T,​java.lang.Object[],​R> fun, boolean fieldTarget, int[] fieldIndices, T target, java.lang.Object... args)  
      static Field<java.lang.Object> apply​(java.util.function.BinaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a, java.lang.Object b)  
      static <R> Field<R> apply​(java.util.function.Function<java.lang.Object[],​R> fun, boolean fieldTarget, int[] fieldIndexes, java.lang.Object target, java.lang.Object... args)  
      static <R> Field<R> apply​(java.util.function.Function<java.lang.Object[],​R> fun, int[] fieldIndexes, java.lang.Object... args)  
      static <R> Field<R> apply​(TriFunction<java.lang.Object,​java.lang.Object,​java.lang.Object,​R> fun, int[] fields, java.lang.Object a, java.lang.Object b, java.lang.Object c)  
      static Field<java.lang.Object> applyWithSingleParam​(java.util.function.UnaryOperator<java.lang.Object> fun, int[] fields, java.lang.Object a)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • applyWithSingleParam

        public static Field<java.lang.Object> applyWithSingleParam​(java.util.function.UnaryOperator<java.lang.Object> fun,
                                                                   int[] fields,
                                                                   java.lang.Object a)
        Parameters:
        fun - the UnaryOperator to apply
        fields - an array of integers containing the indexes of the arguments that are fields
        a - the single parameter
        Returns:
        the result of the execution of fun(a)
      • apply

        public static Field<java.lang.Object> apply​(java.util.function.BinaryOperator<java.lang.Object> fun,
                                                    int[] fields,
                                                    java.lang.Object a,
                                                    java.lang.Object b)
        Parameters:
        fun - the 2-ary function to apply, in form of a BinaryOperator
        fields - an array of integers containing the indexes of the arguments that are fields
        a - the first parameter
        b - the second parameter
        Returns:
        the result of the execution of fun(a, b)
      • apply

        public static <R> Field<R> apply​(TriFunction<java.lang.Object,​java.lang.Object,​java.lang.Object,​R> fun,
                                         int[] fields,
                                         java.lang.Object a,
                                         java.lang.Object b,
                                         java.lang.Object c)
        Type Parameters:
        R - result field type
        Parameters:
        fun - the TriFunction to apply
        fields - an array of integers containing the indexes of the arguments that are fields
        a - the first parameter
        b - the second parameter
        c - the third parameter
        Returns:
        the result of the execution of fun(a, b, c)
      • apply

        public static <R> Field<R> apply​(java.util.function.Function<java.lang.Object[],​R> fun,
                                         int[] fieldIndexes,
                                         java.lang.Object... args)
        Type Parameters:
        R - result field type
        Parameters:
        fun - the function to apply.
        fieldIndexes - the indexes of which among the arguments are fields
        args - the arguments
        Returns:
        a new field resulting from the application of the Function to the target and the arguments
      • apply

        public static <R> Field<R> apply​(java.util.function.Function<java.lang.Object[],​R> fun,
                                         boolean fieldTarget,
                                         int[] fieldIndexes,
                                         java.lang.Object target,
                                         java.lang.Object... args)
        Type Parameters:
        R - result field type
        Parameters:
        fun - the function to apply.
        fieldTarget - true if the target is a field
        fieldIndexes - the indexes of which among the arguments are fields
        target - the object this method will be invoked on
        args - the arguments
        Returns:
        a new field resulting from the application of the Function to the target and the arguments
      • apply

        public static <T,​R> Field<R> apply​(java.util.function.BiFunction<T,​java.lang.Object[],​R> fun,
                                                 boolean fieldTarget,
                                                 int[] fieldIndices,
                                                 T target,
                                                 java.lang.Object... args)
        Type Parameters:
        T - input field type
        R - result field type
        Parameters:
        fun - the function to apply. It must accept as a first argument the data type carried by the target, and an Object array as second argument (namely, it is a vararg)
        fieldTarget - true if the target is a field
        fieldIndices - the indexes of which among the arguments are fields
        target - the object this method will be invoked on
        args - the arguments
        Returns:
        a new field resulting from the application of the BiFunction to the target and the arguments