MCPcopy Create free account
hub / github.com/beanshell/beanshell / importCommands

Method importCommands

src/bsh/NameSpace.java:830–849  ·  view source on GitHub ↗

Import scripted or compiled BeanShell commands in the following package in the classpath. You may use either "/" path or "." package notation. e.g. importCommands("/bsh/commands") or importCommands("bsh.commands") are equivalent. If a relative path style specifier is used then it is made i

( String name )

Source from the content-addressed store, hash-verified

828 made into an absolute path by prepending "/".
829 */
830 public void importCommands( String name )
831 {
832 if ( importedCommands == null )
833 importedCommands = new ArrayList<String>();
834
835 // dots to slashes
836 name = name.replace('.','/');
837 // absolute
838 if ( !name.startsWith("/") )
839 name = "/"+name;
840 // remove trailing (but preserve case of simple "/")
841 if ( name.length() > 1 && name.endsWith("/") )
842 name = name.substring( 0, name.length()-1 );
843
844 // If it exists, remove it and add it at the end (avoid memory leak)
845 importedCommands.remove( name );
846
847 importedCommands.add(name);
848 nameSpaceChanged();
849 }
850
851 /**
852 A command is a scripted method or compiled command class implementing a

Callers 1

loadDefaultImportsMethod · 0.95

Calls 4

nameSpaceChangedMethod · 0.95
replaceMethod · 0.80
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected