Open yolave opened 3 years ago
Hi Yolave!
I'm analyzing, I prefer Optional. I don't particularly like the idea of throwing an exception, although it is very easy to implement.
As I implemented using the step builder pattern I will have problems cascading Optional. It would be a good challenge.
Thank you for the idea.
When using
org.epctagcoder.parse.GIAI.ParseGIAI.Builder()
to create a new instance, setting an invalid RFID tag in the methodorg.epctagcoder.parse.GIAI.ParseGIAI.ChoiceStep.withRFIDTag(String)
produces aNullPointerException
when finally callingorg.epctagcoder.parse.GIAI.ParseGIAI.BuildStep.build()
method.For example, the following snippet will fail:
Instead of
null
, theorg.epctagcoder.parse.GIAI.ParseGIAI.BuildStep.build()
method might throw aParseException
(or any other dedicated exception) or even better, it could return ajava.util.Optional
to be easier to check the result of the parsing.Thank you for this awesome library!