You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contract for the InputPreprocessor interface currently states :
If a null object is returned from this method, the called {@link Parser} implementation is
expected to return either:
* An empty {@link Collection}/ {@link Map} / Array type.
* A null object for types other than above.
It should not be up to the InputPreprocessor to decide if an input string is considered a null object or not.
How about change the contract of InputPreprocessor interface to simply receive a string and return a string (in other words just pre-process the string as the name sugests). It should not be allowed to return a null object.
A second callback interface would be needed instead to decide if a input string should represent a null object or not, something like this:
Where the contract of InputPreprocessor interface has changed to the following:
/** * Callback interface that allows clients to do their own preparation of the input string to parse. * Implementations of this interface are expected to be immutable. * * @see <a href="https://github.com/drapostolos/type-parser/wiki/User-Guide" * target="_blank">User-Guide</a> */publicinterfaceInputPreprocessor {
/** * Prepares the input string to be parsed. Must return a {@link String} object. * <p/> * Returning a <code>null</code> object is not supported. If a null object is return, an * {@link UnsupportedOperationException} will be thrown. * * @param input String to prepare for parsing. This may be a {@code NullString} but will never * be {@code null}. * @param helper Helper class injected automatically by the {@link TypeParser}. * @return a prepared string to be parsed. * @throws RuntimeException Any exception thrown within this method will be wrapped and * re-thrown as a {@link TypeParserException} to the client. */Stringprepare(Stringinput, InputPreprocessorHelperhelper);
}
The contract for the
InputPreprocessor
interface currently states :It should not be up to the
InputPreprocessor
to decide if an input string is considered a null object or not.How about change the contract of
InputPreprocessor
interface to simply receive a string and return a string (in other words just pre-process the string as the name sugests). It should not be allowed to return a null object.A second callback interface would be needed instead to decide if a input string should represent a null object or not, something like this:
Your comments?
The text was updated successfully, but these errors were encountered: