List of usage examples for org.apache.thrift TUnion getFieldValue
public Object getFieldValue()
From source file:org.apache.aurora.scheduler.storage.testing.StorageEntityUtil.java
License:Apache License
private static void assertFullyPopulated(String name, Object object, Set<Field> ignoredFields) { if (object instanceof Collection) { Object[] values = ((Collection<?>) object).toArray(); assertFalse("Collection is empty: " + name, values.length == 0); for (int i = 0; i < values.length; i++) { assertFullyPopulated(name + "[" + i + "]", values[i], ignoredFields); }/*from w w w . j a v a2 s . com*/ } else if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; assertFalse("Map is empty: " + name, map.isEmpty()); for (Map.Entry<?, ?> entry : map.entrySet()) { assertFullyPopulated(name + " key", entry.getKey(), ignoredFields); assertFullyPopulated(name + "[" + entry.getKey() + "]", entry.getValue(), ignoredFields); } } else if (object instanceof TUnion) { TUnion<?, ?> union = (TUnion<?, ?>) object; assertFullyPopulated(name + "." + union.getSetField().getFieldName(), union.getFieldValue(), ignoredFields); } else if (!(object instanceof String) && !(object instanceof Enum)) { for (Field field : object.getClass().getDeclaredFields()) { if (!Modifier.isStatic(field.getModifiers())) { validateField(name, object, field, ignoredFields); } } } }