Note: this is primarily for internal use. @see Interpreter#source( String ) @see Interpreter#eval( String )
( BshMethod method )
| 708 | @see Interpreter#eval( String ) |
| 709 | */ |
| 710 | public void setMethod( BshMethod method ) |
| 711 | throws UtilEvalError |
| 712 | { |
| 713 | //checkMethodModifiers( method ); |
| 714 | |
| 715 | if ( methods == null ) |
| 716 | methods = new HashMap<String,List<BshMethod>>(); |
| 717 | |
| 718 | String name = method.getName(); |
| 719 | List<BshMethod> list = methods.get(name); |
| 720 | |
| 721 | if ( list == null ) { |
| 722 | methods.put(name, Collections.singletonList(method)); |
| 723 | } else { |
| 724 | if( !(list instanceof ArrayList) ) { |
| 725 | list = new ArrayList<BshMethod>(list); |
| 726 | methods.put( name, list ); |
| 727 | } |
| 728 | list.remove(method); |
| 729 | list.add( method ); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | /** |
| 734 | @see #getMethod( String, Class [], boolean ) |