Class ValueResolvers


  • public final class ValueResolvers
    extends Object
    Common value resolvers.
    • Constructor Detail

      • ValueResolvers

        public ValueResolvers()
    • Method Detail

      • collectionResolver

        public static ValueResolver collectionResolver()
      • orResolver

        public static ValueResolver orResolver()
        Returns the default value if the base object is null, empty Optional or not found and the base object otherwise. foo.or(bar), foo or true, name ?: 'elvis'
      • orEmpty

        public static ValueResolver orEmpty()
        Return an empty list if the base object is null or not found.
      • trueResolver

        public static ValueResolver trueResolver()
        Returns Results#NotFound if the base object is falsy and the base object otherwise.

        Can be used together with orResolver() to form a ternary operator. person.isElvis ? 'elvis' : notElvis

      • mapEntryResolver

        public static ValueResolver mapEntryResolver()
      • logicalAndResolver

        public static ValueResolver logicalAndResolver()
        Performs conditional AND on the base object and the first parameter. It's a short-circuiting operation - the parameter is only evaluated if needed.
        See Also:
        Booleans.isFalsy(Object)
      • logicalOrResolver

        public static ValueResolver logicalOrResolver()
        Performs conditional OR on the base object and the first parameter. It's a short-circuiting operation - the parameter is only evaluated if needed.
        See Also:
        Booleans.isFalsy(Object)
      • numberValueResolver

        public static ValueResolver numberValueResolver()