apache / apache/netbeans

Netbeans code templates - string functions

Open
#4,621 2 comments 0 reactions 0 assignees View on GitHub
Editor Java kind:feature pending-response
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

Netbeans contains great tool „[code templates](https://netbeans.apache.org/kb/docs/php/code-templates.html)“ that allows me to simplify my work.

For many years I missed last functionality for the perfection, which is some additional string function.

### Use case/motivation

For example, I have at this time the following code template:

```
/**
* ${PARAMETER newVarName default="Parameter"} getter
*
* @return ${TYPE newVarName default="Parameter"}
*/
protected function get${PARAMETER editable=false}(): ${TYPE editable=false}
{
return $this->${PROPERTY newVarName default="parameter"};
}

/**
* ${PARAMETER editable=false} setter
*
* @param ${TYPE editable=false} $$${PROPERTY editable=false}
* @return static Provides fluent interface
*/
protected function set${PARAMETER editable=false}(${TYPE editable=false} $$${PROPERTY editable=false})
{
$this->${PROPERTY editable=false} = $$${PROPERTY editable=false};
return $this;
}
```

That allows me to quickly generate the code of generic getter & setter and simply replace the name `${PARAMETER}` with the real one. After that I have to replace the name `${PROPERTY}` which should be the same like `${PARAMETER}` but with the first letter lowercase.

Will it be possible please to add functionalities like:
- lower case all
- lower case first letter
- upper case all
- upper case first letter
- replace something with something
- replace something with something by regexp?

### Related issues

_No response_

### Are you willing to submit a pull request?

I want to, but I'm not a Java developer

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start with the linked NetBeans PHP code templates documentation and locate the code-template expansion entry point in the NetBeans sources. Review how existing parameters such as PARAMETER, TYPE, and PROPERTY are handled, then define and test the requested case-conversion and replacement functions, including regular-expression replacement.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, php
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.