枚举类 PartialInlineability
- 所有已实现的接口:
Serializable,Comparable<PartialInlineability>,Constable
BreakBehaviours.breakOnlyIfInnerLevelsThenFitOnOneLine(boolean) where a level is too large to fit on the current line,
but a prefix thereof is partially inlined onto the current line.
Specifically, when inlining a level with the above behaviour, the partial inlineability of its first child level (and that level's first child, recursively) is queried in order to determine if we need to ensure there's enough room for some additional prefix of that level.
The reason for this is to prevent degenerate formattings like
Object foo = someSuperLongMethod(some |
.fully |
.qualified |
.ClassName |
.doSomething()); |
and instead prefer breaking earlier to keep the prefix on the same line, like:
Object foo = someSuperLongMethod( |
some.fully.qualified.ClassName|
.doSomething()); |
Note that this works as a mandatory access control. Namely, if it's allowed to partially inline a level, what are the additional conditions that have to be met in order for the inlining to go ahead.
-
嵌套类概要
从类继承的嵌套类/接口 java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
枚举常量概要
枚举常量枚举常量说明The level may always be partially inlined, regardless of how much space is left on the current line.Partially inlineable if the first inner level of this level fits on the current line. -
方法概要
修饰符和类型方法说明static PartialInlineability返回带有指定名称的该类的枚举常量。static PartialInlineability[]values()返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同
-
枚举常量详细资料
-
ALWAYS_PARTIALLY_INLINEABLE
The level may always be partially inlined, regardless of how much space is left on the current line.This is usually only appropriate for levels that start with a direct
Break, as opposed to a Break that's nested inside some other levels. -
IF_FIRST_LEVEL_FITS
Partially inlineable if the first inner level of this level fits on the current line.This assumes that the next Doc after that starts with a
Break(see) and makes sense in contexts like引用无效
StartsWithBreakVisitorJavaInputAstVisitor.visitDotWithPrefix(java.util.List<com.sun.source.tree.ExpressionTree>, boolean, java.util.Collection<java.lang.Integer>, com.palantir.javaformat.doc.FillMode)where we want to treat first doc (the longest prefix) as a single entity to be fit onto the same line.
-
-
方法详细资料
-
values
返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同- 返回:
- 包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
-
valueOf
返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException- 如果该枚举类没有带有指定名称的常量NullPointerException- 如果参数为空值
-