List of usage examples for org.apache.hadoop.util ReflectionUtils getDeclaredFieldsIncludingInherited
public static List<Field> getDeclaredFieldsIncludingInherited(Class<?> clazz)
From source file:com.datatorrent.stram.engine.Node.java
License:Apache License
public Node(OPERATOR operator, OperatorContext context) { this.operator = operator; this.context = context; outputs = new HashMap<String, Sink<Object>>(); descriptor = new PortMappingDescriptor(); Operators.describe(operator, descriptor); endWindowDequeueTimes = new HashMap<SweepableReservoir, Long>(); tmb = ManagementFactory.getThreadMXBean(); commandResponse = new LinkedBlockingQueue<StatsListener.OperatorResponse>(); metricFields = Lists.newArrayList(); for (Field field : ReflectionUtils.getDeclaredFieldsIncludingInherited(operator.getClass())) { if (field.isAnnotationPresent(AutoMetric.class)) { metricFields.add(field);//from www. java 2 s .c o m field.setAccessible(true); } } metricMethods = Maps.newHashMap(); try { for (PropertyDescriptor pd : Introspector.getBeanInfo(operator.getClass()).getPropertyDescriptors()) { Method readMethod = pd.getReadMethod(); if (readMethod != null) { AutoMetric rfa = readMethod.getAnnotation(AutoMetric.class); if (rfa != null) { metricMethods.put(pd.getName(), readMethod); } } } } catch (IntrospectionException e) { throw new RuntimeException("introspecting {}", e); } }