@@ -130,71 +130,47 @@ public <T> T as(TypeLiteral<T> typeLiteral) {
130130 }
131131
132132 public final boolean toBoolean (Object ... keys ) {
133- Any found = get (keys );
134- if (found .valueType () == ValueType .INVALID ) {
135- return false ;
136- }
137- return found .toBoolean ();
133+ return get (keys ).toBoolean ();
138134 }
139135
140136 public boolean toBoolean () {
141137 throw reportUnexpectedType (ValueType .BOOLEAN );
142138 }
143139
144140 public final int toInt (Object ... keys ) {
145- Any found = get (keys );
146- if (found .valueType () == ValueType .INVALID ) {
147- return 0 ;
148- }
149- return found .toInt ();
141+ return get (keys ).toInt ();
150142 }
151143
152144 public int toInt () {
153145 throw reportUnexpectedType (ValueType .NUMBER );
154146 }
155147
156148 public final long toLong (Object ... keys ) {
157- Any found = get (keys );
158- if (found .valueType () == ValueType .INVALID ) {
159- return 0 ;
160- }
161- return found .toLong ();
149+ return get (keys ).toLong ();
162150 }
163151
164152 public long toLong () {
165153 throw reportUnexpectedType (ValueType .NUMBER );
166154 }
167155
168156 public final float toFloat (Object ... keys ) {
169- Any found = get (keys );
170- if (found .valueType () == ValueType .INVALID ) {
171- return 0 ;
172- }
173- return found .toFloat ();
157+ return get (keys ).toFloat ();
174158 }
175159
176160 public float toFloat () {
177161 throw reportUnexpectedType (ValueType .NUMBER );
178162 }
179163
180164 public final double toDouble (Object ... keys ) {
181- Any found = get (keys );
182- if (found .valueType () == ValueType .INVALID ) {
183- return 0 ;
184- }
185- return found .toDouble ();
165+ return get (keys ).toDouble ();
186166 }
187167
188168 public double toDouble () {
189169 throw reportUnexpectedType (ValueType .NUMBER );
190170 }
191171
192172 public final String toString (Object ... keys ) {
193- Any found = get (keys );
194- if (found .valueType () == ValueType .INVALID ) {
195- return "" ;
196- }
197- return found .toString ();
173+ return get (keys ).toString ();
198174 }
199175
200176
0 commit comments