@@ -160,35 +160,37 @@ private Class[] builtinTypes() {
160160 }
161161
162162 public Method getMethod () throws NoSuchMethodException {
163- if (is (String .class )) {
164- return Value .class .getDeclaredMethod ("value" );
165- }
166- if (is (int .class )) {
167- return Value .class .getDeclaredMethod ("intValue" );
168- }
169- if (is (byte .class )) {
170- return Value .class .getDeclaredMethod ("byteValue" );
171- }
172- if (is (long .class )) {
173- return Value .class .getDeclaredMethod ("longValue" );
174- }
175- if (is (float .class )) {
176- return Value .class .getDeclaredMethod ("floatValue" );
177- }
178- if (is (double .class )) {
179- return Value .class .getDeclaredMethod ("doubleValue" );
180- }
181- if (is (boolean .class )) {
182- return Value .class .getDeclaredMethod ("booleanValue" );
183- }
184- if (is (Optional .class , String .class )) {
185- return Value .class .getDeclaredMethod ("toOptional" );
186- }
187- if (is (List .class , String .class )) {
188- return Value .class .getDeclaredMethod ("toList" );
189- }
190- if (is (Set .class , String .class )) {
191- return Value .class .getDeclaredMethod ("toSet" );
163+ if (!isNullable ()) {
164+ if (is (String .class )) {
165+ return Value .class .getDeclaredMethod ("value" );
166+ }
167+ if (is (int .class )) {
168+ return Value .class .getDeclaredMethod ("intValue" );
169+ }
170+ if (is (byte .class )) {
171+ return Value .class .getDeclaredMethod ("byteValue" );
172+ }
173+ if (is (long .class )) {
174+ return Value .class .getDeclaredMethod ("longValue" );
175+ }
176+ if (is (float .class )) {
177+ return Value .class .getDeclaredMethod ("floatValue" );
178+ }
179+ if (is (double .class )) {
180+ return Value .class .getDeclaredMethod ("doubleValue" );
181+ }
182+ if (is (boolean .class )) {
183+ return Value .class .getDeclaredMethod ("booleanValue" );
184+ }
185+ if (is (Optional .class , String .class )) {
186+ return Value .class .getDeclaredMethod ("toOptional" );
187+ }
188+ if (is (List .class , String .class )) {
189+ return Value .class .getDeclaredMethod ("toList" );
190+ }
191+ if (is (Set .class , String .class )) {
192+ return Value .class .getDeclaredMethod ("toSet" );
193+ }
192194 }
193195 // toOptional(Class)
194196 if (isOptional ()) {
0 commit comments