PropertyManagementConverter { public void readProperties(final Object object) { final JCommanderPrefixTranslator translator = new JCommanderPrefixTranslator(); translator.addObject(object); final JCommanderTranslationMap map = translator.translate(); for (final TranslationEntry entry : map.getEntries().values()) { final AnnotatedElement element = entry.getMember(); final CentroidParameter centroid = element.getAnnotation(CentroidParameter.class); final ClusteringParameter clustering = element.getAnnotation(ClusteringParameter.class); final CommonParameter common = element.getAnnotation(CommonParameter.class); final ExtractParameter extract = element.getAnnotation(ExtractParameter.class); final GlobalParameter global = element.getAnnotation(GlobalParameter.class); final HullParameter hull = element.getAnnotation(HullParameter.class); final InputParameter input = element.getAnnotation(InputParameter.class); final JumpParameter jump = element.getAnnotation(JumpParameter.class); final MapReduceParameter mapReduce = element.getAnnotation(MapReduceParameter.class); final OutputParameter output = element.getAnnotation(OutputParameter.class); final PartitionParameter partition = element.getAnnotation(PartitionParameter.class); final SampleParameter sample = element.getAnnotation(SampleParameter.class); if (centroid != null) { handleEnum(entry, centroid.value()); } if (clustering != null) { handleEnum(entry, clustering.value()); } if (common != null) { handleEnum(entry, common.value()); } if (extract != null) { handleEnum(entry, extract.value()); } if (global != null) { handleEnum(entry, global.value()); } if (hull != null) { handleEnum(entry, hull.value()); } if (input != null) { handleEnum(entry, input.value()); } if (jump != null) { handleEnum(entry, jump.value()); } if (mapReduce != null) { handleEnum(entry, mapReduce.value()); } if (output != null) { handleEnum(entry, output.value()); } if (partition != null) { handleEnum(entry, partition.value()); } if (sample != null) { handleEnum(entry, sample.value()); } } } PropertyManagementConverter(final PropertyManagement properties); PropertyManagement getProperties(); void readProperties(final Object object);  }
@Test public void testConverter() throws Exception { final PropertyManagement propMgmt = new PropertyManagement(); final PropertyManagementConverter conv = new PropertyManagementConverter(propMgmt); final DBScanOptions opts = new DBScanOptions(); opts.setGlobalBatchId("some-value"); conv.readProperties(opts); Assert.assertEquals("some-value", propMgmt.getProperty(GlobalParameters.Global.BATCH_ID)); }