does netbeans support naming conventions for fields, parameters and local variables like eclipse - netbeans

eclipse supports naming conventions for fields, parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both. eclipse respects this configuration when generating methods or getters/setters.
is there a similar configuration option in netbeans? is there another way to achieve the same thing: i want to get parameters with prefixes, when generating implementations for abstract methods and i want the prefix to be removed, when generating getters/setters (example: for _myVar it should generate getMyVar and setMyVar).

You can use Alt + Insert to generate some feature you need like getter and setter and constructors and ... . when you change something you can use re-factor.

Related

Controlling which classes GWT includes with -generateJsInteropExports

Can I control which classes are included when I use -generateJsInteropExports?
I'm finding that when I use the flag, the JS output includes a bunch of classes that I'm not using in the project, but whose source appears in some of the packages I'm using. I don't want these classes to be included in the output. Normally, GWT does a good job of only bringing in classes that I'm actually using.
How can I tell the compiler "in this compilation I'd like you to generate JsInterop for these classes, but not these"?
I found these GWT compiler options:
-includeJsInteropExports/excludeJsInteropExports
Include/exclude members and classes while generating JsInterop exports. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports)
But I couldn't seem to get them to work. I tried using:
-generateJsInteropExports
-includeJsInteropExports com.example.MyClass
The class wasn't included.
The filtering is at the level of class member (i.e. fields and methods) rather than type name. To match all members of a class the syntax is:
-generateJsInteropExports
-includeJsInteropExports com.example.MyClass.*
Note: It's a regular expression, so the dots represent "any character" rather than periods. You'd have to escape them if there were ambiguity.

Is there any difference between the syntax used for TypoScript constants and the syntax for "Extension Configuration"?

For both "TypoScript constants" and "Extension Configuration" (as defined in ext_conf_template.txt) use a common syntax. They are documented here:
Constants (in "TypoScript Template Reference")
Extension Configuration (in "TYPO3 Explained")
An example:
# cat=basic; type=string; label=Some title
title =
Line 1 describes data type, category etc. of the variable.
Alternatively, we might have something like this:
tx_plugins.my_plugin {
# cat=basic; type=string; label=Some title
title =
}
Besides this rather simple example, there are some more things you can do with this.
Where TypoScript constants and Extension Configuration are stored and how they are used is completely different, but I am wondering if we just look at the syntax and the features you can use - is it the same?
e.g.
the available datatypes (boolean, integer etc.)
that you can't use multiline values
that you can use environment variables
how to access files
how to do localization
The reason I ask: To streamline the documentation and also I use this in my own extensions.
Short Answer
The syntax used for TS template constants and extension configuration is the same but there are some minor differences for the available types currently.
Deep Analysis
Extension Configuration
For TYPO3 CMS version 6 the extension manager and configuration was rewriten from scratch based on Extbase and using the FormEngine. Available types are:
int: integer values
int+: positive integer values only
integer: alias for int
color: color picker
wrap: wrap, lines are separated finally by | for the saved value
offset: offset field
options: select
boolean: checkbox
user: user function is used for rendering
small: small text field
string: text field
input: alias for string, only for backwards compatibility, many extensions depend on that
default: alias for string, only for backwards compatibility, many extensions depend on that
Source is available here: https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/ViewHelpers/Form/TypoScriptConstantsViewHelper.php#L36
TypoScript Template Constant Editor
On the other hand the TypoScript template constant editor was never rewriten to make use of the FormEngine and has it's own implementation. Here the following types are additionally available:
comment: a checkbox to switch a constant
files: file selection
Source is available here: https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php#L993
Other Questions
that you can't use multiline values
That's almost true for the TS constant editor but there is the wrap type to achieve a multiline like functionality. For the extension configuration there are the small and string types.
For the other questions I'm currently not aware of and have to investigate a little bit deeper first:
that you can use environment variables
how to access files
how to do localization
As Typoscript is a configuration it can be used in multiple ways. And TYPO3 uses it differntly. So you have to diferentiate.
Constants can be used only for frontend rendering. there they are a shortcut to use a given value in different places.
Or to easily configure something (extension) without knowledge of detailed setup. Therefore you have the Constant-Editor where you can define constants which got a special information/ comment. It's like the TCA, a help to build forms and automaticaly have some validators for data. as TS-constants only are strings which can be used in the setup you do not have real data types. it is just a configuration to have some validation in the Constant-Editor.
Aside from some recursive replacement (up to a level of 10) of constants in constants definition you have no further options to compute a value.
In Typoscript setup you have (meanwhile) stdWrap funtionality nearly everywhere.
But especially extensions don't evaluate it everywhere. so in some places you have an extension configuration in setup where you only can insert fixed strings. (like in the constants)
on the other hand:
how can an extension be configured (with TYPO3-tools)?
Aside from the Typoscript setup (where you can use the constants), which primarily is used for the frontend rendering (*) you have a global option to configure extensions with the extension manager.
This data is stored serialized in typo3conf/LocalConfiguration.php. since TYPO3 9 unserialized.
It can be accessed in frontend and backend and works globaly, while the frontend typoscript or TSconfig is dependend on the page (and user).
This brings us to the third part of configuration: TSconfig
We have page-TSconfig and user-TSconfig. In pages, be_users and be_groups you can define a configuration with typoscript syntax. This can be enhanced with 'global' PHP code of extensions which inject further configuration in ext_localconf.php and ext_tables.php (or the successors in /Configuration/TCA/ and /Configuration/TCA/Overrides/)
(*) some extensions evaluate the frontend typoscript for configuration of backend modules or plugins-options

VS Code Go to Symbol now(v1.42) showing variables, object and properties. How to customize?

Go to Symbol now(v1.42) showing variables, properties in php and object, variables and properties in js.
How to customize it?
How to only show classes, methods and functions in PHP? Similarly for js show functions and methods.
As far as I know there is no such possibility to configure the list of symbol types. The only workaround I know is to add : character, it will group the symbols by type (classes, methods, functions etc).

Mass Rename of Variables and Getter/Setter Methods in Eclipse

I have a large library of Hibernate-annotated bean classes with inconsistent variable naming. For example, in one class, a variable might be named "acceptanceDate" but in another it might be named "dateAccepted". Each class has a get/set method as well.
I am wondering if there is an easy way to rename these variables across the board AS WELL AS rename their accessor methods. (And even better: open projects in eclipse would update their own references to use the new names).
This is probably a long shot, but I figured it couldn't hurt to ask.
Such a functionality simply does not exist in Eclipse. If I were you, I would write a utility class that would scan the given directory recursively for .java files and then parse them one by one to rename the getter / setter methods and their fields as per the convention needed. Parsing does not have to be full-fledged as you are interested in only renaming the fields and their getter setters that match a specific criteria.
Other option is to manually refactor each instance variable and its getter setter using the Refactor --> Rename dialog of Eclipse.

Generate all setXXX calls of a POJO in Eclipse?

Im currently doing a lot of testing with JPA entities, where i have to keep calling the setter methods on the entity that looks something like this :
myEntity.setXXX(value);
myEntity.setYYY(value);
myEntity.setZZZ(value);
Is there any magic shortcut or menu in eclipse IDE to generate all the setter-method-calls that starts with "set", like those displayed in the ctrl-space (auto completion) popup (i think the inherited methods from Object are not being shown at popup) ?
So im imagining something like :
i type myEntity.set
and myEntity.set* are generated right away
Im a lazy programmer and currently using Eclipse Helios IDE.
Thank you !
Edit
Im not looking for source -> generate getter and setter, because that would helps me in generating the methods itself. Generating the method calls is what i want to achieve.
I have found the answer (I was always searching for this thing)...
The easiest way is to expand the class members in the "Package Explorer", sort them by name, multi-select all the setters, and then you have in the clipboard all the method names...
;-)
I like #Oscar's answer. It does lead to some cleanup though.
When I paste from the clipboard, I get something that looks like this:
setOne(int)
setTwo(String)
In order to clean this up, I first add semicolons with this search/replace regexp:
search = (.)$
replace = \1;
Then I add the getter calls (assuming incoming data object is named "data"):
search = s(et.*)\(.*
replace = s\1(data.g\1());
This doesn't handle multiple arguments in a method call...
you can use the outline at right side. There you can sort alphabetically or by declaration order using the toolbar button of the view.
and then you can filter out non required this.
From here also you can copy..all setter functions or getters functions names...
There is eclipse plugin to do that. The name of the plugin is **
FastCode
**. There are so many templates. Among those there is template to generate code for create object of the class and all setters method.
Source --> Generate Getters and Setters...
You can also get at it via the Quick Fix command (Ctrl+1) when the cursor is on a property.
EDIT
If you are simply looking for a faster way to copy properties from one object to another I suggest that you look at using reflection. I think this path would be much easier long term then generating the same-looking code over-and-over.
Commons BeanUtils can take away some of the pain in writing pure reflection code. For example, copyProperties takes a destination bean and either another bean or a Map as the source.