Example usage for org.apache.thrift TUnion getSetField

List of usage examples for org.apache.thrift TUnion getSetField

Introduction

In this page you can find the example usage for org.apache.thrift TUnion getSetField.

Prototype

public F getSetField() 

Source Link

Usage

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 a 2  s  .  c  om*/
    } 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);
            }
        }
    }
}

From source file:org.jhk.pulsing.pail.thrift.structures.PropertyStructure.java

License:Apache License

@Override
public void fillTarget(List<String> ret, Object val) {
    TBase tBase = (TBase) val;
    TUnion tUnion = (TUnion) tBase.getFieldValue(valueId);

    ret.add("" + tUnion.getSetField().getThriftFieldId());
}