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

Method getImportedVar

src/bsh/NameSpace.java:955–983  ·  view source on GitHub ↗
( String name )

Source from the content-addressed store, hash-verified

953 }
954
955 protected Variable getImportedVar( String name )
956 throws UtilEvalError
957 {
958 // Try object imports
959 if ( importedObjects != null )
960 for(int i=0; i<importedObjects.size(); i++)
961 {
962 Object object = importedObjects.get(i);
963 Class clas = object.getClass();
964 Field field = Reflect.resolveJavaField(
965 clas, name, false/*onlyStatic*/ );
966 if ( field != null )
967 return createVariable(
968 name, field.getType(), new LHS( object, field ) );
969 }
970
971 // Try static imports
972 if ( importedStatic!= null )
973 for(int i=0; i<importedStatic.size(); i++)
974 {
975 Class clas = importedStatic.get(i);
976 Field field = Reflect.resolveJavaField(
977 clas, name, true/*onlyStatic*/ );
978 if ( field != null )
979 return createVariable( name, field.getType(), new LHS( field ) );
980 }
981
982 return null;
983 }
984
985 /**
986 Load a command script from the input stream and find the BshMethod in

Callers 1

getVariableImplMethod · 0.95

Calls 6

resolveJavaFieldMethod · 0.95
createVariableMethod · 0.95
getClassMethod · 0.80
getMethod · 0.65
sizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected