Class Values


  • public final class Values
    extends java.lang.Object
    Value utility methods.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Values()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static <T> T[] arrayOf​(java.lang.Class<T> clazz, int len)  
      static <T> Value<T> asSuperclass​(Value<? extends T> value)
      Safely re-cast a value as its superclass.
      static <T> Value<T> cached​(Value<T> value)
      Get a cached value for some opaque value.
      static <T> java.util.List<Value<? extends T>> emptyList()
      The empty value list.
      static <T> Value<java.util.List<T>> emptyListValue()
      A value which yields the empty list.
      static java.lang.Object[] getValues​(java.lang.Iterable<? extends Value<?>> i)
      Get an object array from the result of an iterable series of values.
      static <T> T[] getValues​(java.lang.Iterable<? extends Value<? extends T>> i, java.lang.Class<T> clazz)
      Get a typed object array from the result of an iterable series of values.
      static <T> T[] getValues​(java.lang.Iterable<? extends Value<? extends T>> i, T[] array)
      Get a typed object array from the result of an iterable series of values.
      private static java.lang.Object[] getValues​(java.util.Iterator<? extends Value<?>> i, int idx)  
      private static <T> T[] getValues​(java.util.Iterator<? extends Value<? extends T>> i, java.lang.Class<T> clazz, int idx)  
      static <T> Value<T> immediateValue​(T value)
      Get an immediate value.
      static <T> java.util.List<Value<? extends T>> immediateValues​(java.util.List<T> values)  
      static <T> java.util.List<Value<? extends T>> immediateValues​(T... values)  
      static ThreadLocalValue<java.lang.Object> injectedValue()
      The special value representing the value of an injection operation.
      static <T> Value<T> nullValue()
      Get the null value.
      static ThreadLocalValue<java.lang.Object> thisValue()
      The special value representing this (the object being invoked upon).
      • Methods inherited from class java.lang.Object

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

      • NULL

        private static final Value NULL
      • NONE

        private static final java.lang.Object[] NONE
      • EMPTY_LIST

        public static final java.util.List<Value<?>> EMPTY_LIST
        The empty value list.
      • EMPTY_TYPE_LIST

        public static final java.util.List<? extends Value<java.lang.Class<?>>> EMPTY_TYPE_LIST
        The empty value type list.
      • EMPTY_LIST_VALUE

        private static final Value EMPTY_LIST_VALUE
    • Constructor Detail

      • Values

        private Values()
    • Method Detail

      • getValues

        private static <T> T[] getValues​(java.util.Iterator<? extends Value<? extends T>> i,
                                         java.lang.Class<T> clazz,
                                         int idx)
      • arrayOf

        private static <T> T[] arrayOf​(java.lang.Class<T> clazz,
                                       int len)
      • getValues

        private static java.lang.Object[] getValues​(java.util.Iterator<? extends Value<?>> i,
                                                    int idx)
      • getValues

        public static java.lang.Object[] getValues​(java.lang.Iterable<? extends Value<?>> i)
        Get an object array from the result of an iterable series of values.
        Parameters:
        i - the iterable series
        Returns:
        the values array
      • getValues

        public static <T> T[] getValues​(java.lang.Iterable<? extends Value<? extends T>> i,
                                        java.lang.Class<T> clazz)
        Get a typed object array from the result of an iterable series of values.
        Parameters:
        i - the iterable series
        clazz - the resultant array type
        Returns:
        the values array
      • getValues

        public static <T> T[] getValues​(java.lang.Iterable<? extends Value<? extends T>> i,
                                        T[] array)
        Get a typed object array from the result of an iterable series of values.
        Parameters:
        i - the iterable series
        array - the array to populate
        Returns:
        the values array
      • nullValue

        public static <T> Value<T> nullValue()
        Get the null value.
        Type Parameters:
        T - the value type
        Returns:
        a value which always yields null
      • cached

        public static <T> Value<T> cached​(Value<T> value)
        Get a cached value for some opaque value. If the value is already cached, it is returned as-is.
        Type Parameters:
        T - the value type
        Parameters:
        value - the value to wrap
        Returns:
        a cached value
      • emptyList

        public static <T> java.util.List<Value<? extends T>> emptyList()
        The empty value list.
        Type Parameters:
        T - the value type
        Returns:
        the empty value list
      • immediateValue

        public static <T> Value<T> immediateValue​(T value)
        Get an immediate value.
        Type Parameters:
        T - the value type
        Parameters:
        value - the value to return
        Returns:
        the immediate value
      • emptyListValue

        public static <T> Value<java.util.List<T>> emptyListValue()
        A value which yields the empty list.
        Type Parameters:
        T - the list member type
        Returns:
        the empty list value
      • immediateValues

        public static <T> java.util.List<Value<? extends T>> immediateValues​(java.util.List<T> values)
      • immediateValues

        public static <T> java.util.List<Value<? extends T>> immediateValues​(T... values)
      • asSuperclass

        public static <T> Value<T> asSuperclass​(Value<? extends T> value)
        Safely re-cast a value as its superclass.
        Type Parameters:
        T - the value type
        Parameters:
        value - the value to re-cast
        Returns:
        the value
      • thisValue

        public static ThreadLocalValue<java.lang.Object> thisValue()
        The special value representing this (the object being invoked upon).
        Returns:
        the value for this
      • injectedValue

        public static ThreadLocalValue<java.lang.Object> injectedValue()
        The special value representing the value of an injection operation.
        Returns:
        the target value