File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/main/java/org/apache/ibatis/scripting Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public void register(Class<?> cls) {
32
32
throw new IllegalArgumentException ("null is not a valid Language Driver" );
33
33
}
34
34
if (!LanguageDriver .class .isAssignableFrom (cls )) {
35
- throw new ScriptingException (cls .getName () + " does not implements " + LanguageDriver .class .getName ());
35
+ throw new ScriptingException (cls .getName () + " does not implement " + LanguageDriver .class .getName ());
36
36
}
37
37
LanguageDriver driver = LANGUAGE_DRIVER_MAP .get (cls );
38
38
if (driver == null ) {
@@ -45,6 +45,19 @@ public void register(Class<?> cls) {
45
45
}
46
46
}
47
47
48
+ public void register (LanguageDriver instance ) {
49
+ if (instance == null ) {
50
+ throw new IllegalArgumentException ("null is not a valid Language Driver" );
51
+ }
52
+ if (!LanguageDriver .class .isAssignableFrom (instance .getClass ())) {
53
+ throw new ScriptingException (instance .getClass ().getName () + " does not implement " + LanguageDriver .class .getName ());
54
+ }
55
+ LanguageDriver driver = LANGUAGE_DRIVER_MAP .get (instance .getClass ());
56
+ if (driver == null ) {
57
+ LANGUAGE_DRIVER_MAP .put (instance .getClass (), driver );
58
+ }
59
+ }
60
+
48
61
public LanguageDriver getDriver (Class <?> cls ) {
49
62
return LANGUAGE_DRIVER_MAP .get (cls );
50
63
}
You can’t perform that action at this time.
0 commit comments