private List < String > splitOperation ( String pOperation ) { List < String > ret = new ArrayList < String > ( ) ; Pattern p = Pattern . compile ( "^(.*)\\((.*)\\)$" ) ; Matcher m = p . matcher ( pOperation ) ; if ( m . matches ( ) ) { ret . add ( m . group ( 1 ) ) ; if ( m . group ( 2 ) . length ( ) > 0 ) { // No escaping required since the parts a Java types which does not // allow for commas String [ ] args = m . group ( 2 ) . split ( "\\s*,\\s*" ) ; ret . addAll ( Arrays . asList ( args ) ) ; } else { // It's "()" which means a no-arg method ret . add ( null ) ; } } else { ret . add ( pOperation ) ; } return ret ; }
Extract operation and optional type parameters