Enum Class PartialInlineability
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe 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. -
Method Summary
Modifier and TypeMethodDescriptionstatic PartialInlineabilityReturns the enum constant of this class with the specified name.static PartialInlineability[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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(seeStartsWithBreakVisitor) and makes sense in contexts likeJavaInputAstVisitor.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.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-