New NetBeans Plugin to Generate Getter & Setter Methods for JavaFX Properties

JavaFxPropertyHelper NetBeans Plugin Released

 

This NetBeans plugin will help to generate get/set methods for JavaFx properties that are contained within a POJO.

The standard get/set code generator creates the following get/set methods for a JavaFx property which is not ideal:

private StringProperty name;

public StringProperty getName() { 
    return name;
}
public void setName( StringProperty name ) {
    this.name = name;
}

This plugin would create the following methods:

public String getName() {
    return name.get();
}

public void setName( String value ) {
    name.set(value);
}

public StringProperty nameProperty() {
    return name;
}

It’s also possible to use variables with the suffix Property in their names which will create the following methods:

private StringProperty nameProperty;
public String getName() {
    return nameProperty.get();
}

public void setName( String value ) {
    nameProperty.set(value);
}

public StringProperty nameProperty() {
    return nameProperty;
}

Usage

Press Alt-Insert to get the “Generate” popup menu, and select “Java FX Getter and Setter…” alt tag

Methods for supported property types will automatically be generated. alt tag

Supported Property Types

  • StringProperty
  • BooleanProperty
  • DoubleProperty
  • FloatProperty
  • IntegerProperty
  • LongProperty

Unsupported Property Types

  • ListProperty
  • MapProperty
  • ObjectProperty
  • SetProperty

The plugin is current available on GitHub at:

https://github.com/rterp/JavaFxPropertyHelperNBPlugin/releases/tag/1.1.1

and will hopefully be available via the general NetBeans Plugin portal by next week.

 

Advertisements

2 thoughts on “New NetBeans Plugin to Generate Getter & Setter Methods for JavaFX Properties

  1. Pingback: JavaFX links of the week, December 7 // JavaFX News, Demos and Insight // FX Experience

  2. Pingback: Java desktop links of the week, December 7 « Jonathan Giles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s