org.springframework.security.util.FieldUtils Java Examples

The following examples show how to use org.springframework.security.util.FieldUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiMarkupCache.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Custom implementation designed to be used with Spring IoC, so that we
 * can inject the required caches (e.g. Ehcache).
 *
 * @param markupCache cache to use for markup
 * @param markupKeyCache cache to use for markup cache keys
 */
public MultiMarkupCache(final ICache<String, Markup> markupCache,
                        final ICache<String, String> markupKeyCache) {
    super();
    /*
     * MarkupCache invokes same method ({@link #newCacheImplementation()}) for both
     * fields therefore it is very unreliable to depend on the order of execution.
     *
     * Instead we use reflection to inject the caches so that we know for sure that we are
     * using the right implementation for the right fields.
     */
    FieldUtils.setProtectedFieldValue("markupCache", this, markupCache);
    FieldUtils.setProtectedFieldValue("markupKeyCache", this, markupKeyCache);
}
 
Example #2
Source File: SimpleUserDetailsServiceTest.java    From Spring with Apache License 2.0 4 votes vote down vote up
private Field fieldFor(Class<?> aClass, String fieldName) {
	Field idForEncode = FieldUtils.getField(aClass, fieldName);
	idForEncode.setAccessible(true);
	return idForEncode;
}
 
Example #3
Source File: JLinePrompt.java    From rya with Apache License 2.0 4 votes vote down vote up
/**
 * @return The shell's {@link ConsoleReader}.
 */
public ConsoleReader getReader() {
    // XXX Spring Shell doesn't expose the reader that we need to use to
    //     read values from a terminal, so use reflection to pull it out.
    return (ConsoleReader) FieldUtils.getProtectedFieldValue("reader", shell);
}