errael commented on a change in pull request #2333:
URL: https://github.com/apache/netbeans/pull/2333#discussion_r480386652
##########
File path:
javafx/javafx2.editor/src/org/netbeans/modules/javafx2/editor/completion/beans/BeanModelBuilder.java
##########
@@ -310,6 +310,78 @@ private void processGetters() {
addMapProperty(m, n);
}
}
+ if (allProperties.isEmpty() && !resultInfo.isFxInstance()) {
+ processGettersCheckForImmutables();
+ }
+ }
+
+ private static final String NAMED_ARG = "javafx.beans.NamedArg";
+
+ /** Some javafx classes, such as Insets, are immutable and do not have
+ * no argument constructors or setters; so they are not found.
+ * Accept a property if there is a getter with a corresponding
+ * constructor param declared with NamedArg annotation; use constructor
+ * with the most NamedArg parameters.
+ * <p/>
+ * One alternate strategy would be to provide a document with lines like:
+ * "Insets: top bottom left right" and use this info.
+ */
+ private void processGettersCheckForImmutables() {
+ Set<String> propsConstructor = Collections.emptySet();
+ Set<String> props1 = new HashSet<>();
+ CHECK_CONSTR: for (ExecutableElement c :
ElementFilter.constructorsIn(classElement.getEnclosedElements())) {
+ props1.clear();
+
+ CHECK_PARAMS: for (VariableElement p : c.getParameters()) {
+ for (AnnotationMirror am : p.getAnnotationMirrors()) {
+ if (NAMED_ARG.equals(am.getAnnotationType().toString())) {
Review comment:
Exactly stuff I was looking for. Much cleaner/better.
Though note `am.getAnnotationType()` javadoc for this toString does say `If
possible, the string should be of a form suitable for representing this type in
source code.`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists