Java Code Examples for org.apache.commons.lang3.reflect.FieldUtils#readStaticField()
The following examples show how to use
org.apache.commons.lang3.reflect.FieldUtils#readStaticField() .
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: ApiBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierEraseFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getEraseFields(); } catch (Exception e) { return null; } }
Example 2
Source File: ApiBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierCopyFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getCopyFields(); } catch (Exception e) { return null; } }
Example 3
Source File: ApiBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** 判断字段是否在Wi中但是没有在Entity类中说明是Wi新增字段,需要进行描述 */ private Boolean inWiNotInEntity(String field, Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; if ((null != FieldUtils.getField(copier.getOrigClass(), field, true)) && (null == FieldUtils.getField(copier.getDestClass(), field, true))) { return true; } return false; } catch (Exception e) { return null; } }
Example 4
Source File: Describe.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierEraseFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getEraseFields(); } catch (Exception e) { return null; } }
Example 5
Source File: Describe.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierCopyFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getCopyFields(); } catch (Exception e) { return null; } }
Example 6
Source File: Describe.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** 判断字段是否在Wi中但是没有在Entity类中说明是Wi新增字段,需要进行描述 */ private Boolean inWiNotInEntity(String field, Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; if ((null != FieldUtils.getField(copier.getOrigClass(), field, true)) && (null == FieldUtils.getField(copier.getDestClass(), field, true))) { return true; } return false; } catch (Exception e) { return null; } }
Example 7
Source File: DescribeBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierEraseFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getEraseFields(); } catch (Exception e) { return null; } }
Example 8
Source File: DescribeBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
private List<String> listCopierCopyFields(Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; return copier.getCopyFields(); } catch (Exception e) { return null; } }
Example 9
Source File: DescribeBuilder.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
/** 判断字段是否在Wi中但是没有在Entity类中说明是Wi新增字段,需要进行描述 */ private Boolean inWiNotInEntity(String field, Class<?> clz) { try { Object o = FieldUtils.readStaticField(clz, "copier", true); WrapCopier copier = (WrapCopier) o; if ((null != FieldUtils.getField(copier.getOrigClass(), field, true)) && (null == FieldUtils.getField(copier.getDestClass(), field, true))) { return true; } return false; } catch (Exception e) { return null; } }
Example 10
Source File: ITJUnitUtils.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public static void initClasses(Class<?>... classes) throws Throwable { for (Class<?> cls : classes) { for (Field field : FieldUtils.getAllFieldsList(cls)) { if (Consumers.class.isAssignableFrom(field.getType()) || GateRestTemplate.class.isAssignableFrom(field.getType()) || ITSCBRestTemplate.class.isAssignableFrom(field.getType())) { Object target = FieldUtils.readStaticField(field, true); MethodUtils.invokeMethod(target, "init"); } } } }
Example 11
Source File: Fields.java From junit-servers with MIT License | 5 votes |
/** * Read private static field on given class. * * @param klass The class. * @param name The field name. * @param <T> Type of returned value. * @return The field value. */ public static <T> T readPrivateStatic(Class<?> klass, String name) { Field field = FieldUtils.getDeclaredField(klass, name, true); FieldUtils.removeFinalModifier(field); try { @SuppressWarnings("unchecked") T value = (T) FieldUtils.readStaticField(field, true); return value; } catch (IllegalAccessException ex) { throw new AssertionError(ex); } }