Example usage for org.springframework.security.util FieldUtils getProtectedFieldValue

List of usage examples for org.springframework.security.util FieldUtils getProtectedFieldValue

Introduction

In this page you can find the example usage for org.springframework.security.util FieldUtils getProtectedFieldValue.

Prototype

public static Object getProtectedFieldValue(String protectedField, Object object) 

Source Link

Usage

From source file:com.qcadoo.customTranslation.internal.CustomTranslationManagementServiceImpl.java

private Session getCurrentSession(final DataDefinition dataDefinition) {
    Object dataAccessService = FieldUtils.getProtectedFieldValue("dataAccessService", dataDefinition);
    Object hibernateService = FieldUtils.getProtectedFieldValue("hibernateService", dataAccessService);

    try {/*from  w ww  .j a  v a2s  . com*/
        return (Session) MethodUtils.invokeExactMethod(hibernateService, "getCurrentSession", new Object[0]);
    } catch (NoSuchMethodException e) {
        throw new IllegalStateException(e.getMessage(), e);
    } catch (IllegalAccessException e) {
        throw new IllegalStateException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}