Lets you configure the line wrapping behavior for individual elements.
Jalopy supports different wrapping strategies that can be applied to individual elements as required. To configure wrapping for a specific element, locate the element in the tree and select the current strategy. A pop-up menu will open that lets you change the strategy. The preview instantly reflects any change so you can easily recognize what the impact of a different strategy would be. The current available strategies are:
Disables wrapping for a specific element altogether. Please note that disabling wrapping might lead to long lines that exceed the maximal line length and should therefore preferably only be used with certain elements to avoid line wrapping at specific positions.
Example 2.138. Wrapping disabled for import declaration
|
import com.mycompanyname.myprojectname.mypackagename.MyClassName;
|
Example 2.139. Wrapping enabled for import declaration
import com.mycompanyname.myprojectname.mypackagename |
.MyClassName; |
Only wraps when otherwise the maximal line length limit would be exceeded. One could refer to this policy as lower level or late line wrapping. This strategy favors the use of horizontal space and leads to compact code, but might make certain constructs difficult to read because there is sometimes no clear visual boundary between elements when used exclusively.
Example 2.140. Wrap only when necessary after assignment
String value = "xxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxx" | + "xxxxxxxxxxxxx"; |
Example 2.141. Wrap when exceed after assignment
String value = |
"xxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxx" + "xxxxxxxxxxxxx"; |
Wraps if an element would not fit completely into the current line. Think of it as higher level or early line wrapping. This is probably the most balanced strategy when available that combines very readable results with moderate vertical space requirements.
Example 2.142. Wrapped within extends clause when necessary
interface Testable extends Transferable, Recordable, | Playable, Immutable, Serializable { | } |
Example 2.143. Wrapped before extends keyword when exceed
interface Testable | extends Transferable, Recordable, Playable, | Immutable, Serializable { | } |
Forces a line break for all related elements (like declaration parameters) if the first element has been wrapped. This leads to very uniform and readable code at the expense of higher vertical space requirements.
Example 2.144. Wrapped expression when necessary
while ( | "picker".equals(xxxxxxxxxxxxxxxxxxxxxxxxxx.getName()) | && m.isStatic() && m.isPublic() && m.isFinal()) { | ... | } |
Example 2.145. Wrapped all operators as first operand wrapped
while ( | "picker".equals(xxxxxxxxxxxxxxxxxxxxxxxxxx.getName()) | && m.isStatic() | && m.isPublic() | && m.isFinal()) { | ... | } |
Similar to Wrap all when first wrapped, but forces a line break for all related elements (like declaration parameters), if the whole element would not fit into the current line.
Example 2.146. Wrapped expression when necessary
_userDatabase.addUser( |
"John", "Doo", encryptPassword("password", secretKey), |
"123 Nashville", "Surgrass"); |
Example 2.147. Wrapped all operators as first operand wrapped
_userDatabase.addUser( |
"John", |
"Doo", |
encryptPassword("password", secretKey), |
"123 Nashville", |
"Surgrass"); |
Always wraps a specific element or elements (like call arguments). This can be useful to ensure a consistent style e.g. for chained calls or parameter lists, but also to force line breaks at unusual positions that would normally not be considered during line wrapping.
Please note that not all strategies apply to all elements, and therefore you might be presented with a different set of strategies for each element. Below you find all currently available elements listed along with some short examples of the output with different wrapping strategies.
For import declarations you can choose whether they should be wrapped along the dots if otherwise the maximal line length would be exceeded or not at all.
Since 1.4
Example 2.150. Very long import declaration
|
import com.mycompanyname.myprojectname.mypackagename.MyClassName;
|
Example 2.151. Wrapped import declaration
import com.mycompanyname.myprojectname.mypackagename |
.MyClassName; |
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you choose to force a line break before class,
interface enum and
@interface keywords or disable line wrapping completely.
Since 1.4
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you force a line break after the class keyword or
disable line wrapping altogether.
Since 1.3
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you either force a line break before the extends keyword of class/interface/enum declarations, only print a line break if the extends clause would not completely fit into one line, or print a line break only if the extends clause would otherwise exceed the maximal line length. Only wrapping when absolutely necessary will require the least vertical space and yield the most compact code, but readability might be affected.
Example 2.156. Wrapping necessary
interface InterfaceWithAHugeAndSillyName | extends Amicable, Adorable { | ... | } |
Enforcing a line break before the keyword if the complete clause would not fit into one line, provides a good balance between readability and space requirements.
Example 2.157. Extends clause does not fit into one line
| interface Testable extends Transferable, Recordable, Playable { | ... | } |
Example 2.158. Line break because extends clause would not fit into one line
interface Testable | extends Transferable, Recordable, Playable { | ... | } |
Always enforcing a line break before the keyword might be a viable strategy to achieve the most consistent behavior at the expense of slightly higher vertical space requirements.
Example 2.159. No line wrapping necessary
interface Enyoyable extends Amicable, Adorable { | ... | } |
You can control the space printed before the keyword via the indentation settings. See “Extends indent size” for more information. For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you configure the wrapping behavior for the type names of extended classes.
Example 2.161. Class/interface extends types
public interface Channel extends Puttable, Takable { ... }
Example 2.162. Wrapped class/interface extends types (Endline indented)
public interface Channel extends Puttable, Takable { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line break before the implements keyword of a class declaration.
Example 2.163. implements keyword
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
Example 2.164. Wrapped implements keyword (Standard indented)
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
You can control the space printed before the keyword via the indentation settings. See “Implements indent size” for more information. For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after each type name of the implemented classes.
Example 2.165. Class implements types
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
Example 2.166. Wrapped class implements types (Endline indented)
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line break before the throws keyword of a method/constructor declaration.
Example 2.167. throws keyword
private File getDestinationFile(File dest, String packageName, String filename) throws IOException { ... }
Example 2.168. Wrapped throws keyword (Endline indented)
private File getDestinationFile(File dest, String packageName, String filename) throws IOException { ... }
You can control the space printed before the keyword via the indentation settings. See “Throws indent size” for more information. For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line break after the throws keyword.
Since 1.3
Example 2.170. Throws signature (wrapped)
public void foo() throws FooException, BarException { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after each type name of the throws clause of a method/constructor declaration.
Example 2.171. throws types
private File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
Example 2.172. Wrapped throws types (Standard indented)
private static final File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
Example 2.173. Wrapped throws types (Endline indented)
private File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
When enabled, forces a line break after each enum constant of an enum declaration.
Since 1.2
Example 2.175. Forced line break after enum constants
public enum Season { WINTER, SPRING, SUMMER, FALL }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap before the name of an instance field declaration. Please note that this option does not apply for multi-variables.
Since 1.2
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
When enabled, a line break will be printed after the type identifier of the declaration.
Since 1.0
Example 2.179. Force wrap after type of multi-variables (Standard indented)
BigInteger
q = null, p = null, g = null;
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
When enabled, each declaration of a multi-variable declaration gets always printed on a new line. Otherwise, wrapping only occurs when necessary.
Since 1.0
Example 2.181. Force wrap after each declarator of multi-variables (Endline indented)
BigInteger q = null, p = null, g = null;
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap before the name of a method or constructor declaration.
Since 1.0.3
Example 2.183. Method declaration with line break between return type and name
public static int foo() { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line break after each parameter of a method or constructor declaration.
Example 2.184. Method declaration parameters
public static File create(File file, File directory, int backupLevel) throws IOException { ... }
Example 2.185. Wrapped method declaration parameters (Endline indented)
public static File create(File file, File directory, int backupLevel) throws IOException { ... }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you either force a line break before each call chain, preferably print a line break before a call chain if the whole call cannot be printed in just one line, only print a line break before a call chain when absolutely necessary to avoid breaking the line length limit, or disable line wrapping before call chains altoghether.
You can (and probably should) have the individual call chains aligned. See below for instructions how to achieve such a style
Example 2.186. Always wrap chained method call
buf.append("xxxxxxxxxxxxxxx") .append("xxxxx") .insert(0, "xxxxxxxxxxxxxx") .append("xxx") .insert(0, "xxx");
Stricly enforcing a line break before each call chain is the simplest strategy, and leads to very uniform und easy to read code, but has the highest vertical space requirements.
Example 2.187. Wrap chained method call when exceed
buf.append("xxxxxxxxxxxxxxx").append("xxxxx") .insert(0, "xxxxxxxxxxxxxx").append("xxx").insert(0, "xxx");
Preferably wrapping before the call chain if the whole chain cannot be printed in one line, is the most sensible approach if you want a more compact, yet readable result.
Example 2.188. Wrap chained method call when necessary
buf.append("xxxxxxxxxxxxxxx").append("xxxxx").insert(0, "xxxxxxxxxxxxxx").append("xxx").insert(0, "xxx");
If you want the most compact
Example 2.189. Never wrap chained method call
|
message.format(ERROR_SOURCE_ADDRESS).param(m_session.getAimName()).send();
|
buf.append("xxxxxxxxxxxxxxx").append("xxxxx").insert(0, |
"xxxxxxxxxxxxxx").append("AAA").insert(0, "xxx"); |
Disabling wrapping before call chains altoghether, only makes a difference for calls without arguments. Otherwise, wrapping may still happen within the argument list, as you can see in the above example.
You can control the indentation for chained method calls with either “Indent dotted expressions” or “Align chained method calls”. For enhanced readability it's probably best to have chained calls aligned.
Example 2.190. Aligned chained method call
buf.append("xxxxxxxxxxxxxxx") .append("xxxxx") .insert(0, "xxxxxxxxxxxxxx") .append("xxx") .insert(0, "xxx");
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after each method call chain of nested method calls, i.e. method calls used as call arguments.
Since 1.6
Example 2.191. Chained method call
message.format(ERROR_SOURCE_ADDRESS).param (m_session.getAimName()).send();
Example 2.192. Wrapped chained method call (aligned)
message.format(ERROR_SOURCE_ADDRESS)
.param (m_session.getAimName())
.send();
Please note that you can control the alignment for chained method calls with the the section called “Nested chained method calls” option. For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after each argument of a method call.
Example 2.193. Method call
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
Example 2.194. Wrapped method call (Endline indented)
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after each argument of a method call if at least one argument is a method call itself. This option can prove especially useful if one prefers to nest method calls as arguments rather than adding local variables just to hold those arguments.
Example 2.195. Wrapped nested method call (Endline indented)
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior of marker annotations. Marker annotations are
annotations with no elements, e.g. @Preliminary. There are four
strategies you can choose from:
| Wrap when necessary | Only issue a line break after a marker annotation if otherwise the maximal line length limit would be exceeded |
| Wrap when exceed | Issue a line break after a marker annotation if the declaration does not fit within the maximal line length. Requires all marker annotations to appear before all other modifiers |
| Wrap last | Issue a line break after the last marker annotation. Requires all marker annotations to appear before all other modifiers |
| Wrap always | Issue a line break after each marker annotation. Requires all marker annotations to appear before all other modifiers |
You can ensure that marker annotations appear before other Java modifiers via the modifier sorting settings, see the section called “Modifiers” for more information
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Since 1.1
Example 2.198. No line break after marker annotation when modifier(s) before
public @Preliminary class TimeTravel { ... }
Lets you control the wrapping behavior of marker annotations that appear within declaration parameters. There are two strategies you can choose from:
| Wrap never | Never issue a line break after a marker annotation |
| Wrap when necessary | Only issue a line break after a marker annotation if otherwise the maximal line length limit would be exceeded |
The second strategy only makes sense when using one of the endline indentation strategies. Otherwise line wrapping will preferably happen after the left parenthesis when necessary.
Since 1.9.3
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior of the left parenthesis of normal and single-member annotations. You can avoid a line break altogether, only print a line break if the annotation would otherwise exceed the maximal line length, or print a line break whenever an annotation takes more than just one line.
Never wrapping is the best choice when using the section called “Strict Endline”, but with the other indentation strategies it depends on your preference and the annotations you use whether a line break is desirable. If you don’t want to disable wrapping for annotations altogether, it is recommended to allow a line break after the left parenthesis.
Since 1.9.2
Example 2.201. Never wrap, endline indent
@WebService(name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult(targetNamespace = "com.company.jaxws.space.order") public Receipt placeOrder(Order order); | } |
Example 2.202. Never wrap, standard indent
@WebService(name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult(targetNamespace = "com.company.jaxws.space.order") public Receipt placeOrder(Order order); | } |
Wrapping after the left parenthesis often provides more horizontal space and therefore can keep your annotations within the maximal line limit. When using anything other than the section called “Strict Endline” you probably want to at least enable this strategy if the line length limit is important.
Example 2.203. Wrap when necessary
@WebService(name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult( | targetNamespace = "com.company.jaxws.space.order") | public Receipt placeOrder(Order order); | } |
Wrap when exceed is the most aggressive strategy that will preferably issue a line break after the left parentheses whenever the annotation will take more than one line. This works best when using “Standard indentation”, but might be desirable otherwise as well. But please note that because of backward compatibility constraints “Wrap before right parenthesis” must be enabled then.
Example 2.204. Wrap when exceed, standard indent
@WebService( | name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult( | targetNamespace = "com.company.jaxws.space.order") | public Receipt placeOrder(Order order); | } |
Example 2.205. Wrap when necessary, mixed endline
@WebService( | name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult( | targetNamespace = "com.company.jaxws.space.order") | public Receipt placeOrder(Order order); | } |
Lets you control the wrapping behavior of the member expressions of normal annotations. You can disable wrapping altogether, only wrap after a member element when really necessary, or force line wrapping after each element. Never wrapping can easily lead to long lines which exceeded the maximal line length, but this might be acceptable.
Since 1.5
Example 2.206. No line break after members
| @WebService(name="FooDemoService", targetNamespace="com.foo.Namespace") public class BitTwiddle { | } |
Please note that for nested annotations, wrapping might still happen depending on your parentheses preferences. If you want to disable wrapping for annotations altogether, you need to set the parentheses options to "Never wrap" as well.
Example 2.207. No line break after members
@Author( | @Name(first = "Joe", last = "Hacker", location = "Redmond") | ) | public class BitTwiddle { ... } |
If the line length limit it important, you should at least enable "Wrap when necessary". This ensures that a line break will occur after an annotation member whenever the next annotation would exceed the maximal line length.
Example 2.208. Wrap when necessary
@WebService(name = "FooDemoService", | targetNamespace = "com.foo.demo.Namespace") | | public class BitTwiddle { ... } |
Taking to the extreme, you can enforce a line break after each annotation member. This takes more vertical space, but leads to very unified and readable code. Probably best to allow wrapping after the left parentheses when not using the section called “Strict Endline”.
Example 2.209. Force wrap
@WebService( | name = "FooService", | namespace = "com.foo.Namespace") | public class BitTwiddle { ... } |
Example 2.210. Force wrap
@Author( @Name( first = "Joe", last = "Hacker" ) ) public class BitTwiddle { }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior of the right parenthesis of normal and single-member annotations. You can avoid a line break altogether, only print a line break if the annotation would otherwise exceed the maximal line length, or print a line break whenever an annotation takes more than just one line.
Never wrapping is a good choice from an aesthetical point of view and should suffice for most needs. Only if you are anal about the maximal line length limit, you really should select another strategy.
Since 1.9.2
Example 2.211. Never wrap, endline indent
@WebService(name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult(targetNamespace = "com.company.jaxws.space.order") public Receipt placeOrder(Order order); | }
Example 2.212. Never wrap, standard indent
@WebService(name = "com.company.FooDemoService", | targetNamespace = "com.foo.demo") | public interface Foo { | @WebResult(targetNamespace = "com.company.jaxws.space.order") public Receipt placeOrder(Order order); | }
Wrapping before the right parenthesis should be required only on very rare occasions, because preferably a line break should happen after the left parenthesis. But if you absolutely strive to keep lines within the maximal line length limit, you should enable this strategy.
Example 2.213. Wrap when necessary
@WebResult(targetNamespace = "com.company.project.as.jaxws.space.order"| ) | public interface Foo { } |
In case you prefer to let annotation members stand out, you can enable "Wrap when exceed". This way, a line break will be printed before the right parenthesis whenever the annotation list takes more than just one line to print and a line break has been printed after the left parenthesis. You might want to enable the corresponding strategy for the left parenthesis option if you like such a style.
Example 2.214. Wrap when exceed, standard indent
@WebService( name = "com.company.FooDemoService", targetNamespace = "com.foo.demo" )
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you specify whether wrapping along the dots of chained index operators should be disabled.
Since 1.0
Note how in the above example wrapping does not occur along the dots of the index operator, but right after the assignment! For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after the first operand.
Example 2.217. Wrapped ternary expression question mark (Endline indented)
String comma = spaceAfterComma
? COMMA_SPACE : COMMA;
Indentation for consecutive lines depends on the used indentation scheme. See the section called “Strategies” for more information. You may further want to use continuation indentation. For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after the second operand.
Example 2.218. Wrapped ternary expression colon (Endline indented)
String comma = spaceAfterComma ? COMMA_SPACE
: COMMA;
If both switches are disabled, ternary expressions are printed in one line (if everything fits in one line, that is).
If both switches are enabled, you can force a style like the following:
Example 2.220. Wrapped ternary expressions (Standard indented)
String comma = spaceAfterComma
? COMMA_SPACE
: COMMA;
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you specify whether wrapping along the dots of qualifiers should be disabled.
Since 1.0
Note how in the above example, wrapping does not occur along the dots of the qualifier, but before the method call! For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you specify whether wrapping along dotted expressions should be disabled. This option covers all dotted expressions not handled by the more specific options for chained method calls, index operators or qualifiers (see above). The option is enabled by default for compatibility reasons. If you’re serious about the maximal line length limit, we recommend to disable the option.
Since 1.5
Example 2.223. Wrapped dotted expression
boolean test = ((com.foo.highfly.test.internal.Foo) container) |
.transportDebugFlag; |
|
Example 2.224. Dotted expression (wrapping disabled)
boolean test = |
((com.foo.highfly.test.internal.Foo) container).transportDebugFlag;
|
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the way wrapping takes action for assignments. If left disabled, line wrapping preferably occurs as part of the expression printing. Otherwise wrapping will be performed right after the assignment whenever the expression cannot be printed in just one line.
Example 2.225. Prefer wrap along the expression
this.interessentenNr = new InteressentenNr( Fachschluesselerzeugung.createService() .getNeuerFachschluessel( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT ) );
Example 2.226. Prefer wrap after assignment
this.interessentenNr = new InteressentenNr( Fachschluesselerzeugung.createService() .getNeuerFachschluessel( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT ) );
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior for return statements. When enabled, a line break is inserted after the return statement when the expression would exceed the maximal line length.
Since 1.2.1
Example 2.227. return statement
return ((getKey() == null) ? (other.getKey() == null) | : getKey().equals(other.getKey())); |
Example 2.228. Prefer wrapping after return statement
return | ((getKey() == null) ? (other.getKey() == null) | : getKey().equals(other.getKey())); |
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior for parameter, statement and expression lists. When left disabled, the first line break will be preferably inserted behind the first parameter or expression and only occurs after the left parenthesis if the maximal line length would be otherwise exceeded.
Example 2.229. Wrap after left parenthesis (disabled)
appServerReferencesVector.add(new AppServerReference( "RemoteApplicationManager", poa.create_reference_with_id( "RemoteApplicationManager".getBytes(), RemoteApplicationManagerHelper.id())));
When enabled, the line break will always occur behind the left parenthesis when the list parameters, arguments or expressions cannot be printed in just one line.
Example 2.230. Wrap after left parenthesis (enabled)
appServerReferencesVector.add(
new AppServerReference(
"RemoteApplicationManager",
poa.create_reference_with_id(
"RemoteApplicationManager".getBytes(),
RemoteApplicationManagerHelper.id())));
This option affects the output style of method/constructor declarations and
calls, creator calls and if-else, for,
while and do-while blocks.
As per default, the wrapped lines will be indented using standard indentation,
but you may want to apply another indentation scheme. See
the section called “Strategies” for more information.
For general information about the available wrapping strategies, please refer to the
wrapping strategies overview.
Prints a line break before the right parenthesis of parameter or expression
lists when at least one parameter/expression was wrapped. The parenthesis will
be intended according to the current indentation level.
This switch affects the output style of method/constructor declarations and
calls, creator calls and if-else, for,
while and do-while blocks.
Example 2.231. Right parenthesis (disabled)
public void severalParameters(String one, int two, String three, StringObject four, AnotherObject five) { }
Example 2.232. Right parenthesis (enabled)
public void severalParameters(String one, int two, String three, StringObject four, AnotherObject five ) { }
Both switches combined, looks like the following example:
Example 2.233. Left and right parenthesis
appServerReferencesVector.add(
new AppServerReference(
"RemoteApplicationManager",
poa.create_reference_with_id(
"RemoteApplicationManager".getBytes(),
RemoteApplicationManagerHelper.id()
)
)
);
For blocks the output may go like this:
Example 2.234. Left and right parenthesis (wrapped)
if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; } else if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Lets you control the wrapping behavior for grouping parentheses. When enabled, line breaks are inserted after left and before right parentheses of grouped expressions to let the expression(s) stand out.
Example 2.235. Grouping parentheses (standard indented)
if ( !((bankverbindung instanceof ObjectValue) || (bankverbindung instanceof PrimitiveValue)) ) { throw new RuntimeException(); }
Example 2.236. Wrapped grouping parentheses (standard indented)
if ( !( (bankverbindung instanceof ObjectValue) || (bankverbindung instanceof TkPrimitiveValue) ) ) { throw new RuntimeException(); }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
When enabled, type parameters of parametrized (generic) types are wrapped, when necessary.
Since 1.4
Example 2.237. Parameterized type that lead to exceeded maximal line length
| private final Map<Short, String> example = new HashMap<Short, String>(); |
Example 2.238. Wrapped parameterized type (endline indented)
| private final Map<Short, String> example = new HashMap<Short, | String>(); | |
Please note that with Endline indentation enabled, wrapping only happens if both type parameter names are either not single-lettered or contain one ore more bounds.
Example 2.239. Exceptions when using endline indentation
| public class Test<A, B extends Comparable<B> & Cloneable> { } |
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces a line wrap after labels.
Example 2.240. Label
// advance to the first CLASS_DEF or INTERFACE_DEF LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
Example 2.241. Wrapped label (Standard indented)
// advance to the first CLASS_DEF or INTERFACE_DEF LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
Forces line wrapping after assignments of public constants that are defined in a class whose name ends with the “Registry” suffix.
Since 1.7
Example 2.242. Registry keys
class FooRegistry { public final static boolean ALLOW_FAKE_FOOS = "com.company.layer.Foo"; }
Example 2.243. Registry keys (wrapping forced)
class FooRegistry { public final static boolean ALLOW_FAKE_FOOS = "com.company.layer.Foo"; }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.
When enabled, this switch will cause all parameters/expressions to be wrapped, if and only if the first parameter/expression of the list has been wrapped.
Example 2.244. Expression list (all wrapped)
if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; } else if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; }
For general information about the available wrapping strategies, please refer to the wrapping strategies overview.