public static < Param > PathParamSerializer < Param > required ( String name , Function < String , Param > deserialize , Function < Param , String > serialize ) { return new NamedPathParamSerializer < Param > ( name ) { @ Override public PSequence < String > serialize ( Param parameter ) { return TreePVector . singleton ( serialize . apply ( parameter ) ) ; } @ Override public Param deserialize ( PSequence < String > parameters ) { if ( parameters . isEmpty ( ) ) { throw new IllegalArgumentException ( name + " parameter is required" ) ; } else { return deserialize . apply ( parameters . get ( 0 ) ) ; } } } ; }
Create a PathParamSerializer for required parameters .