You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/06/13 15:41:37 UTC

(commons-jelly) 19/24: Use final

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jelly.git

commit b5064e7eaff0fd251999043b53bc0eb9c656c054
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Fri Jun 13 11:36:21 2025 -0400

    Use final
    
    - Simplify if statement
---
 .../tags/jface/window/ApplicationWindowTag.java    | 29 +++++++++++-----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/jelly-tags/jface/src/main/java/org/apache/commons/jelly/tags/jface/window/ApplicationWindowTag.java b/jelly-tags/jface/src/main/java/org/apache/commons/jelly/tags/jface/window/ApplicationWindowTag.java
index 5477dfe8..072fc007 100644
--- a/jelly-tags/jface/src/main/java/org/apache/commons/jelly/tags/jface/window/ApplicationWindowTag.java
+++ b/jelly-tags/jface/src/main/java/org/apache/commons/jelly/tags/jface/window/ApplicationWindowTag.java
@@ -34,12 +34,12 @@ import org.eclipse.swt.widgets.Shell;
 public class ApplicationWindowTag extends UseBeanTag {
 
     private Shell parent;
-    private int style = SWT.NULL;
+    private final int style = SWT.NULL;
 
     /**
      * @param tagClass
      */
-    public ApplicationWindowTag(Class tagClass) {
+    public ApplicationWindowTag(final Class tagClass) {
         super(tagClass);
     }
 
@@ -47,34 +47,33 @@ public class ApplicationWindowTag extends UseBeanTag {
      * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
      */
     @Override
-    public void doTag(XMLOutput output)
+    public void doTag(final XMLOutput output)
         throws MissingAttributeException, JellyTagException {
-        Map attributes = getAttributes();
-        Object parent = attributes.remove("parent");
+        final Map attributes = getAttributes();
+        final Object parent = attributes.remove("parent");
         if (parent != null) {
-            if (parent instanceof Shell) {
-                this.parent = (Shell) parent;
-            } else {
+            if (!(parent instanceof Shell)) {
                 throw new JellyTagException(
                     "The parent attribute is not a Shell, it is of type: "
                         + parent.getClass().getName()
                         + " value: "
                         + parent);
             }
+            this.parent = (Shell) parent;
         }
 
         super.doTag(output);
 
         // set Title of applicationWindow
-        Object title = attributes.remove("title");
+        final Object title = attributes.remove("title");
         if (title != null) {
             getWindow().getShell().setText((String)title);
         }
 
         // set size of applicationWindow
-        Object size = attributes.remove("size");
+        final Object size = attributes.remove("size");
         if (size != null) {
-            Point point = new PointConverter().parse((String) size);
+            final Point point = new PointConverter().parse((String) size);
             getWindow().getShell().setSize(point);
         }
     }
@@ -84,9 +83,9 @@ public class ApplicationWindowTag extends UseBeanTag {
      */
     @Override
     protected Object newInstance(
-        Class theClass,
-        Map attributes,
-        XMLOutput output)
+        final Class theClass,
+        final Map attributes,
+        final XMLOutput output)
         throws JellyTagException {
 
         return new ApplicationWindowImpl(parent);
@@ -96,7 +95,7 @@ public class ApplicationWindowTag extends UseBeanTag {
      * @return the visible window, if there is one.
      */
     public Window getWindow() {
-        Object bean = getBean();
+        final Object bean = getBean();
         if (bean instanceof Window) {
             return (Window) bean;
         }