I need a Eclipse or IDEA plugin to generate field name constant string in java. For example, in ORM we often define a class Like this:
class DealDB {
public String dealId;
}
We can generate get and set method with eclipse or IDEA, but we cannot generate field name constant string. When we write query code in java, we often need this constant string.
class DealDB {
public String dealId;
// to generate this
public static final String FIELD_DEALID="dealId";
}
Maybe extend lombok (https://projectlombok.org/) can implement this.
In IntelliJ, I can suggest something that is not exactly what you are asking for, but it comes close.
Take the following code sample, containing the String "dealId".
public static void main(String[] args) {
System.out.println("dealId");
}
Position the cursor on "dealId" and hit Ctrl - Alt - C (refactor: Create Constant).
IntelliJ will pop up with a dialog and then create the following for you:
public static final String DEAL_ID = "dealId";
You also have option to "Replace all occurences" and "Move to another class".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With