if (extraction instanceof ThriftFieldExtractor) {
ThriftFieldExtractor thriftFieldExtractor = (ThriftFieldExtractor) extraction;
return thriftFieldExtractor.getField().get(instance);
}
else if (extraction instanceof ThriftMethodExtractor) {
ThriftMethodExtractor thriftMethodExtractor = (ThriftMethodExtractor) extraction;
return thriftMethodExtractor.getMethod().invoke(instance);
}
throw new IllegalAccessException("Unsupported field extractor type " + extraction.getClass().getName());
}
throw new IllegalAccessException("No extraction present for " + field);
}