Package com.diffplug.spotless
Class Jvm.Support<V>
- java.lang.Object
-
- com.diffplug.spotless.Jvm.Support<V>
-
- Type Parameters:
V
- Version type of formatter
- Enclosing class:
- Jvm
public static class Jvm.Support<V> extends java.lang.Object
Utility to map constraints of formatter to this JVM
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Jvm.Support<V>
add(int minimumJvmVersion, V maxFormatterVersion)
Add maximum supported formatter versionJvm.Support<V>
addMin(int minimumJvmVersion, V minFormatterVersion)
void
assertFormatterSupported(V formatterVersion)
Assert the formatter is supportedV
getMinimumRequiredFormatterVersion()
V
getRecommendedFormatterVersion()
FormatterFunc
suggestLaterVersionOnError(V formatterVersion, FormatterFunc originalFunc)
Suggest to use a different formatter version if formatting failsjava.lang.String
toString()
-
-
-
Method Detail
-
add
public Jvm.Support<V> add(int minimumJvmVersion, V maxFormatterVersion)
Add maximum supported formatter version- Parameters:
minimumJvmVersion
- Minimum Java version requiredmaxFormatterVersion
- Maximum formatter version supported by the Java version- Returns:
- this
-
addMin
public Jvm.Support<V> addMin(int minimumJvmVersion, V minFormatterVersion)
-
getRecommendedFormatterVersion
@Nullable public V getRecommendedFormatterVersion()
- Returns:
- Highest formatter version recommended for this JVM (null, if JVM not supported)
-
getMinimumRequiredFormatterVersion
@Nullable public V getMinimumRequiredFormatterVersion()
-
assertFormatterSupported
public void assertFormatterSupported(V formatterVersion)
Assert the formatter is supported- Parameters:
formatterVersion
- Formatter version- Throws:
java.lang.IllegalArgumentException
- ifformatterVersion
not supported
-
suggestLaterVersionOnError
public FormatterFunc suggestLaterVersionOnError(V formatterVersion, FormatterFunc originalFunc)
Suggest to use a different formatter version if formatting fails- Parameters:
formatterVersion
- Formatter versionoriginalFunc
- Formatter function- Returns:
- Wrapped formatter function. Adding hint about later versions to exceptions.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-