View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2024 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle.checks.blocks;
21  
22  /**
23   * Represents the options for placing the left curly brace <code>'{'</code>.
24   *
25   */
26  public enum LeftCurlyOption {
27  
28      /**
29       * Represents the policy for placing the brace at the end of line. For
30       * example:
31       * <pre>
32       * if (condition) {
33       *     ...
34       * </pre>
35       **/
36      EOL,
37  
38      /**
39       * Represents the policy that if the brace will fit on the first line of
40       * the statement, then apply {@code EOL} rule.
41       * Otherwise apply the {@code NL} rule.
42       * {@code NLOW} is a mnemonic for "new line on wrap".
43       *
44       * <p>For the example above Checkstyle will enforce:
45       *
46       * <pre>
47       * if (condition) {
48       *     ...
49       * </pre>
50       *
51       * <p>But for a statement spanning multiple lines, Checkstyle will enforce:
52       *
53       * <pre>
54       * if (condition1 &amp;&amp; condition2 &amp;&amp;
55       *     condition3 &amp;&amp; condition4)
56       * {
57       *     ...
58       * </pre>
59       *
60       **/
61      NLOW,
62  
63      /**
64       * Represents the policy that the brace must always be on a new line. For
65       * example:
66       * <pre>
67       * if (condition)
68       * {
69       *     ...
70       * </pre>
71       */
72      NL,
73  
74  }