public static void inject(Object object, Map<String, Object> parameters) { try { log.debug("Using ParameterInjection to set parameters..."); ParameterInjection.inject(object, parameters); } catch (Exception e) { log.error("Failed to inject parameters: {}", e.getMessage()); if (log.isDebugEnabled()) e.printStackTrace(); } }
public static void main(String[] args) throws Exception { Map<String, Object> params = new HashMap<String, Object>(); params.put("startId", new Long(100L)); params.put("key", "x"); HideFeature proc = new HideFeature(); ParameterInjection.inject(proc, params); Data datum = new DataImpl(); datum.put("x", 1.0d); datum.put("y", 2.10d); log.debug("Initial datum: {}", datum); datum = proc.process(datum); log.debug("Processed datum: {}", datum); Map<String, ParameterType> types = discoverParameterTypes(stream.data.mapper.MapKeys.class); for (String key : types.keySet()) { log.info("Found '{}' = {}", key, types.get(key)); } log.info("------------------------------------------------------------------"); types = discoverParameterTypes(stream.data.mapper.CreateID.class); for (String key : types.keySet()) { log.info("Found '{}' = {}", key, types.get(key)); } log.info("------------------------------------------------------------------"); types = discoverParameterTypes(stream.data.mapper.MapValueToID.class); for (String key : types.keySet()) { log.info("Found '{}' = {}", key, types.get(key)); } }