Formatting an enum using formatter-maven-plugin (Java)

Overview

Use formatter-maven-plugin to automatically format the enum code.

The format you want to achieve

Before execution

public enum Answer {

  YES(1),NO(2),MAYBE(3);
}

After execution

public enum Answer {

  YES(1),
  NO(2),
  MAYBE(3);
}

Setting location

The above format could be applied by setting the value of ʻalignment_for_enum_constantsin the configuration file (xml) to49`.

    <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>

Recommended Posts

Formatting an enum using formatter-maven-plugin (Java)
[Java] enum
[Java] Express Enum type without using Enum (enumeration) type
Map without using an array in java
[Java] Send an email using Amazon SES
[Java] Convert DB code to code value using enum
Sorting using java comparator
Java Enum utilization example
[java] throw an exception
Scraping practice using Java ②
Quickly implement a singleton with an enum in Java
Scraping practice using Java ①
I tried using an extended for statement in Java
[Java] About enum type
I want to build Java Applet without using an IDE
Try using RocksDB in Java
About an instance of java
Try scraping using java [Notes]
Using Mapper with Java (Spring)
I tried using Java REPL
Reproduce Java enum in C #
Using Docker from Java Gradle
Make a rhombus using Java
Bubble sort using ArrayList (JAVA)