Class MethodParsers
java.lang.Object
com.iohao.net.framework.core.flow.parser.MethodParsers
Registry of
MethodParser implementations, mapping parameter types to their parsers.
Provides lookup, registration, and default-fallback for action method parameter/return type parsers.
Built-in parsers handle primitive types (int, long, boolean, String)
and their protocol wrapper counterparts.
- Author:
- 渔民小镇
- date:
- 2022-06-26
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Clear all registered parsers and parameter suppliers.static booleancontainsKey(Class<?> clazz) Check whether a parser is registered for the given class.static MethodParsergetMethodParser(ActualParameter actionMethodReturn) Get the method parser for the given action method return or parameter metadata.static MethodParsergetMethodParser(Class<?> paramClazz) Get the method parser for the given parameter class.keySet()static voidmapping(Class<?> paramClass, MethodParser methodParamParser) Register a method parser for the given parameter class.static voidmappingParamSupplier(Class<?> paramClass, Supplier<?> supplier) Register a parameter supplier for the given class, used to create default instances when data is null.static voidsetMethodParser(MethodParser methodParser) Default parser for action business method parameters
-
Method Details
-
clear
public static void clear()Clear all registered parsers and parameter suppliers. -
mappingParamSupplier
-
getMethodParser
Get the method parser for the given action method return or parameter metadata.- Parameters:
actionMethodReturn- the return or parameter type metadata- Returns:
- the matching parser, or the default parser if no specific one is registered
-
keySet
-
getMethodParser
Get the method parser for the given parameter class.- Parameters:
paramClazz- the parameter class- Returns:
- the matching parser, or the default parser if no specific one is registered
-
containsKey
Check whether a parser is registered for the given class.- Parameters:
clazz- the class to check- Returns:
trueif a parser is registered for this class
-
mapping
Register a method parser for the given parameter class.- Parameters:
paramClass- the parameter classmethodParamParser- the parser to handle this class
-
setMethodParser
Default parser for action business method parameters
-