@@ -106,10 +106,10 @@ public static Integer toInteger(Object anObj) {
106106 if (anObj == null )
107107 return null ;
108108 Integer tmpResult = null ;
109- if (anObj instanceof Integer ) {
110- tmpResult = ( Integer ) anObj ;
111- } else if (anObj instanceof Number ) {
112- tmpResult = new Integer ((( Number ) anObj ) .intValue ());
109+ if (anObj instanceof Integer i ) {
110+ tmpResult = i ;
111+ } else if (anObj instanceof Number n ) {
112+ tmpResult = new Integer (n .intValue ());
113113 } else {
114114 try {
115115 tmpResult = new Integer (toString (anObj ));
@@ -142,10 +142,10 @@ public static Float toFloat(Object anObj) {
142142 if (anObj == null )
143143 return null ;
144144 Float tmpResult = null ;
145- if (anObj instanceof Float ) {
146- tmpResult = ( Float ) anObj ;
147- } else if (anObj instanceof Number ) {
148- tmpResult = new Float ((( Number ) anObj ) .floatValue ());
145+ if (anObj instanceof Float f ) {
146+ tmpResult = f ;
147+ } else if (anObj instanceof Number n ) {
148+ tmpResult = new Float (n .floatValue ());
149149 } else {
150150 try {
151151 tmpResult = new Float (toString (anObj ));
@@ -189,8 +189,8 @@ public static Boolean toBoolean(Object anObj) {
189189 Boolean tmpResult = null ;
190190 if (anObj == null ) {
191191 // nothing to do
192- } else if (anObj instanceof Boolean ) {
193- tmpResult = ( Boolean ) anObj ;
192+ } else if (anObj instanceof Boolean b ) {
193+ tmpResult = b ;
194194 } else {
195195 final String tmpStr = toString (anObj );
196196 if ("true" .equalsIgnoreCase (tmpStr ) || "yes" .equalsIgnoreCase (tmpStr ) || "on" .equalsIgnoreCase (tmpStr )) {
0 commit comments