@ Action ( name = "List Size" , outputs = { @ Output ( RESULT_TEXT ) , @ Output ( RESPONSE ) , @ Output ( RETURN_RESULT ) , @ Output ( RETURN_CODE ) } , responses = { @ Response ( text = Constants . ResponseNames . SUCCESS , field = RETURN_CODE , value = RETURN_CODE_SUCCESS , matchType = MatchType . COMPARE_EQUAL ) , @ Response ( text = Constants . ResponseNames . FAILURE , field = RETURN_CODE , value = RETURN_CODE_FAILURE , matchType = MatchType . COMPARE_EQUAL , isOnFail = true , isDefault = true ) } ) public Map < String , String > getListSize ( @ Param ( value = LIST , required = true ) String list , @ Param ( value = DELIMITER , required = true ) String delimiter ) { Map < String , String > result = new HashMap <> ( ) ; try { String [ ] table = ListProcessor . toArray ( list , delimiter ) ; result . put ( RESULT_TEXT , String . valueOf ( table . length ) ) ; result . put ( RESPONSE , Constants . ResponseNames . SUCCESS ) ; result . put ( RETURN_RESULT , String . valueOf ( table . length ) ) ; result . put ( RETURN_CODE , RETURN_CODE_SUCCESS ) ; } catch ( Exception e ) { result . put ( RESULT_TEXT , e . getMessage ( ) ) ; result . put ( RESPONSE , Constants . ResponseNames . FAILURE ) ; result . put ( RETURN_RESULT , e . getMessage ( ) ) ; result . put ( RETURN_CODE , RETURN_CODE_FAILURE ) ; } return result ; }
This method returns the length of a list of strings .