Vs code

Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P). Type "Snippets: Configure User Snippets" and select the option. Choose the language for which you want to create the snippet (e.g., "java"). This will create a file named java.json within the .vscode/snippets directory.

Inside java.json

{
    "fxprop-boolean": {
        "prefix": "fxprop-boolean",
        "body": [
            "// ${1:propertyName}",
            "private final BooleanProperty ${1:propertyName} = new SimpleBooleanProperty(this, \"${1:propertyName}\");",
            "",
            "public final BooleanProperty ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final boolean is${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(boolean value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-boolean-readonly": {
        "prefix": "fxprop-boolean-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyBooleanWrapper ${1:propertyName} = new ReadOnlyBooleanWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyBooleanWrapper ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final boolean is${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-double": {
        "prefix": "fxprop-double",
        "body": [
            "// ${1:propertyName}",
            "private final DoubleProperty ${1:propertyName} = new SimpleDoubleProperty(this, \"${1:propertyName}\");",
            "",
            "public final DoubleProperty ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final double get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(double value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-double-readonly": {
        "prefix": "fxprop-double-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyDoubleWrapper ${1:propertyName} = new ReadOnlyDoubleWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyDoubleWrapper ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final double get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-integer": {
        "prefix": "fxprop-integer",
        "body": [
            "// ${1:propertyName}",
            "private final IntegerProperty ${1:propertyName} = new SimpleIntegerProperty(this, \"${1:propertyName}\");",
            "",
            "public final IntegerProperty ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final int get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(int value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-integer-readonly": {
        "prefix": "fxprop-integer-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyIntegerWrapper ${1:propertyName} = new ReadOnlyIntegerWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyIntegerWrapper ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final int get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-long": {
        "prefix": "fxprop-long",
        "body": [
            "// ${1:propertyName}",
            "private final LongProperty ${1:propertyName} = new SimpleLongProperty(this, \"${1:propertyName}\");",
            "",
            "public final LongProperty ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final long get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(long value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-long-readonly": {
        "prefix": "fxprop-long-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyLongWrapper ${1:propertyName} = new ReadOnlyLongWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyLongWrapper ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final long get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-object": {
        "prefix": "fxprop-object",
        "body": [
            "// ${1:propertyName}",
            "private final ObjectProperty<${2:propertyType}> ${1:propertyName} = new SimpleObjectProperty<>(this, \"${1:propertyName}\");",
            "",
            "public final ObjectProperty<${2:propertyType}> ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final ${2:propertyType} get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(${2:propertyType} value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-object-readonly": {
        "prefix": "fxprop-object-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyObjectWrapper<${2:propertyType}> ${1:propertyName} = new ReadOnlyObjectWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyObjectWrapper<${2:propertyType}> ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final ${2:propertyType} get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-string": {
        "prefix": "fxprop-string",
        "body": [
            "// ${1:propertyName}",
            "private final StringProperty ${1:propertyName} = new SimpleStringProperty(this, \"${1:propertyName}\");",
            "",
            "public final StringProperty ${1:propertyName}Property() {",
            "   return ${1:propertyName};",
            "}",
            "public final String get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(String value) {",
            "    ${1:propertyName}Property().set(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-string-readonly": {
        "prefix": "fxprop-string-readonly",
        "body": [
            "// ${1:propertyName}",
            "private final ReadOnlyStringWrapper ${1:propertyName} = new ReadOnlyStringWrapper(this, \"${1:propertyName}\");",
            "",
            "public final ReadOnlyStringWrapper ${1:propertyName}Property() {",
            "   return ${1:propertyName}.getReadOnlyProperty();",
            "}",
            "public final String get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName}Property().get();",
            "}"
        ],
        "description": "Generates a JavaFX boolean property with getters and setters"
    },
    "fxprop-list": {
        "prefix": "fxprop-list",
        "body": [
            "// ${1:propertyName}",
            "private final SimpleListProperty<${2:propertyType}> ${1:propertyName} = new SimpleListProperty(this, \"${1:propertyName}\", FXCollections.observableArrayList());",
            "",
            "public final SimpleListProperty<${2:propertyType}> get${1/(.*)/${1:/capitalize}/}() {",
            "   return ${1:propertyName};",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(List<${2:propertyType}> value) {",
            "    get${1/(.*)/${1:/capitalize}/}().setAll(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "fxprop-list-lazy": {
        "prefix": "fxprop-list-lazy",
        "body": [
            "// ${1:propertyName}",
            "private final SimpleListProperty<${2:propertyType}> ${1:propertyName};",
            "",
            "public final SimpleListProperty<${2:propertyType}> get${1/(.*)/${1:/capitalize}/}() {",
            "   if(${1:propertyName} == null){",
            "       ${1:propertyName = new SimpleListProperty(this, \"${1:propertyName}\", FXCollections.observableArrayList());"
            "   }"
            "   return ${1:propertyName};",
            "}",
            "public final void set${1/(.*)/${1:/capitalize}/}(List<${2:propertyType}> value) {",
            "    get${1/(.*)/${1:/capitalize}/}().setAll(value);",
            "}"
        ],
        "description": "Generates a JavaFX string property with getters and setters"
    },
    "log": {
        "prefix": "log",
        "body": [
            "private static final Logger log = LoggerFactory.getLogger(${1:className}.class);"
        ],
        "description": "Inserts a Logger declaration for the copied class name"
    }
}

Comments