Class FromStringParserRegistry
java.lang.Object
io.github.grumpystuff.grumpyjson.registry.Sealable
io.github.grumpystuff.grumpyjson.registry.Registry<Type,FromStringParser>
io.github.grumpystuff.grumpyrest.request.stringparser.FromStringParserRegistry
- All Implemented Interfaces:
ParseFromStringService
public final class FromStringParserRegistry
extends Registry<Type,FromStringParser>
implements ParseFromStringService
This registry keeps
FromStringParsers used to parse path parameters and querystring parameters.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FromStringParsergenerateRegistrable(Type type) protected StringparseFromString(String text, Type type) Parses a string to obtain a value of the specified type.protected booleanregistrableSupports(FromStringParser registrable, Type key) Methods inherited from class io.github.grumpystuff.grumpyjson.registry.Registry
clear, get, onSeal, register, supportsMethods inherited from class io.github.grumpystuff.grumpyjson.registry.Sealable
ensureConfigurationPhase, ensureRunTimePhase, seal
-
Constructor Details
-
FromStringParserRegistry
public FromStringParserRegistry()Constructor. This constructor does not register any standard parsers, but theRestApicalling this constructor does.
-
-
Method Details
-
generateRegistrable
- Specified by:
generateRegistrablein classRegistry<Type,FromStringParser>
-
getErrorMessageForUnknownKey
- Specified by:
getErrorMessageForUnknownKeyin classRegistry<Type,FromStringParser>
-
registrableSupports
- Specified by:
registrableSupportsin classRegistry<Type,FromStringParser>
-
parseFromString
Description copied from interface:ParseFromStringServiceParses a string to obtain a value of the specified type.- Specified by:
parseFromStringin interfaceParseFromStringService- Parameters:
text- the text to parsetype- the type to convert to- Returns:
- the converted value
- Throws:
FromStringParserException- if conversion fails because the text does not conform to the expected format according to the type to convert to
-