public FEELFnResult<List<String>> invoke(@ParameterName("string") String string, @ParameterName("delimiter") String delimiter, @ParameterName("flags") String flags) {
if (string == null) {
return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "string", "cannot be null" ) );
}
if ( delimiter == null ) {
return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "cannot be null" ) );
}
try {
int f = processFlags( flags );
Pattern p = Pattern.compile( delimiter, f );
String[] split = p.split(string, -1);
return FEELFnResult.ofResult( Arrays.asList( split ) );
} catch ( PatternSyntaxException e ) {
return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "is invalid and can not be compiled", e ) );
} catch ( IllegalArgumentException t ) {
return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) );
} catch ( Throwable t) {
return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "delimiter", "is invalid and can not be compiled", t ) );
}
}