以下は、他の誰かが書いたクラスです。
私が直面している問題は、parse method
withnull as the rawString
に入ったときに を投げていることですNumberFormatException
。
だから私がやろうと思っていたのは、その NumberFormatException とset the value itself as null
. それで、私がした方法は正しいですか?
public class ByteAttr {
@JExType(sequence = 1)
private Byte value;
public static ByteAttr parse(String rawString) {
ByteAttr attr = new ByteAttr();
try {
attr.setValue(Byte.valueOf(rawString));
} catch (NumberFormatException nfEx) {
attr.setValue(null);
}
return attr;
}
public Byte getValue() {
return this.value;
}
public void setValue(Byte value) {
this.value = value;
}
}