com.jn.sqlhelper.mybatis.BoundSqls Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlhelper-mybatis Show documentation
Show all versions of sqlhelper-mybatis Show documentation
Supports mybatis (an ORM framework)
package com.jn.sqlhelper.mybatis;
import org.apache.ibatis.mapping.BoundSql;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Map;
class BoundSqls {
private static Field additionalParametersField;
static Map getAdditionalParameter(final BoundSql boundSql) {
if (additionalParametersField != null) {
try {
return (Map) additionalParametersField.get(boundSql);
} catch (IllegalAccessException ex) {
// Noop
}
}
return Collections.emptyMap();
}
static {
try {
(additionalParametersField = BoundSql.class.getDeclaredField("additionalParameters")).setAccessible(true);
} catch (NoSuchFieldException ex) {
// Noop
}
}
}