All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jn.sqlhelper.mybatis.BoundSqls Maven / Gradle / Ivy

There is a newer version: 5.0.9
Show newest version
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
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy