Java Code Examples for org.apache.cxf.common.util.ReflectionUtil#getDeclaredField()
The following examples show how to use
org.apache.cxf.common.util.ReflectionUtil#getDeclaredField() .
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: CxfCdiAutoSetup.java From openwebbeans-meecrowave with Apache License 2.0 | 6 votes |
private void dump(final LogFacade log, final ServerProviderFactory spf, final String description, final String fieldName) { final Field field = ReflectionUtil.getDeclaredField(ProviderFactory.class, fieldName); if (!field.isAccessible()) { field.setAccessible(true); } try { final Collection<ProviderInfo<?>> providers = Collection.class.cast(field.get(spf)); log.info(" " + description); providers.stream().map(ProviderInfo::getProvider).forEach(o -> { try { log.info(" - " + o); } catch (final RuntimeException re) { // no-op: maybe cdi context is not active } }); } catch (IllegalAccessException e) { // ignore, not that a big deal } }
Example 2
Source File: URLConnectionHTTPConduit.java From cxf with Apache License 2.0 | 6 votes |
private OutputStream connectAndGetOutputStream(Boolean b) throws IOException { OutputStream cout = null; if (b != null && b) { String method = connection.getRequestMethod(); connection.connect(); try { java.lang.reflect.Field f = ReflectionUtil.getDeclaredField(HttpURLConnection.class, "method"); ReflectionUtil.setAccessible(f).set(connection, "POST"); cout = connection.getOutputStream(); ReflectionUtil.setAccessible(f).set(connection, method); } catch (Throwable t) { logStackTrace(t); } } else { cout = connection.getOutputStream(); } return cout; }
Example 3
Source File: InjectionUtils.java From cxf with Apache License 2.0 | 5 votes |
public static Field getDeclaredField(Class<?> cls, String fieldName) { if (cls == null || cls == Object.class) { return null; } Field f = ReflectionUtil.getDeclaredField(cls, fieldName); if (f != null) { return f; } return getDeclaredField(cls.getSuperclass(), fieldName); }
Example 4
Source File: ResourceInjector.java From cxf with Apache License 2.0 | 5 votes |
private static Field getField(Class<?> cls, String name) { if (cls == null) { return null; } try { Field f = ReflectionUtil.getDeclaredField(cls, name); if (f == null) { f = getField(cls.getSuperclass(), name); } return f; } catch (Exception ex) { return getField(cls.getSuperclass(), name); } }
Example 5
Source File: HttpsURLConnectionFactoryTest.java From cxf with Apache License 2.0 | 4 votes |
private void clearDefaults() throws IllegalAccessException { Field defaultManagers = ReflectionUtil.getDeclaredField(SSLUtils.class, "defaultManagers"); ReflectionUtil.setAccessible(defaultManagers); defaultManagers.set(SSLUtils.class, null); }
Example 6
Source File: DOMUtils.java From cxf with Apache License 2.0 | 4 votes |
@Override protected Field computeValue(Class<?> type) { return ReflectionUtil.getDeclaredField(type, "documentFragment"); }