Class Util

java.lang.Object
com.squareup.javapoet.Util

final class Util extends Object
Like Guava, but worse and standalone. This makes it easier to mix JavaPoet with libraries that bring their own version of Guava.
  • Field Details

    • DEFAULT

      static final Modifier DEFAULT
      Modifier.DEFAULT doesn't exist until Java 8, but we want to run on earlier releases.
  • Constructor Details

    • Util

      private Util()
  • Method Details

    • immutableMultimap

      static <K, V> Map<K,List<V>> immutableMultimap(Map<K,List<V>> multimap)
    • immutableMap

      static <K, V> Map<K,V> immutableMap(Map<K,V> map)
    • checkArgument

      static void checkArgument(boolean condition, String format, Object... args)
    • checkNotNull

      static <T> T checkNotNull(T reference, String format, Object... args)
    • checkState

      static void checkState(boolean condition, String format, Object... args)
    • immutableList

      static <T> List<T> immutableList(Collection<T> collection)
    • immutableSet

      static <T> Set<T> immutableSet(Collection<T> set)
    • join

      static String join(String separator, List<String> parts)
    • union

      static <T> Set<T> union(Set<T> a, Set<T> b)
    • requireExactlyOneOf

      static void requireExactlyOneOf(Set<Modifier> modifiers, Modifier... mutuallyExclusive)
    • hasDefaultModifier

      static boolean hasDefaultModifier(Collection<Modifier> modifiers)
    • characterLiteralWithoutSingleQuotes

      static String characterLiteralWithoutSingleQuotes(char c)
    • stringLiteralWithDoubleQuotes

      static String stringLiteralWithDoubleQuotes(String value, String indent)
      Returns the string literal representing value, including wrapping double quotes.