@Override protected void addPropertyDirect(String key, Object value) { Object previousValue = getProperty(key); if (previousValue == null) { map.put(key, value); } else if (previousValue instanceof List) { // the value is added to the existing list // Note: This is problematic. See header comment! ((List<Object>) previousValue).add(value); } else { // the previous value is replaced by a list containing the previous value and the new value List<Object> list = new ArrayList<Object>(); list.add(previousValue); list.add(value); map.put(key, list); } }
@Override protected void addPropertyDirect(String key, Object value) { Object previousValue = getProperty(key); if (previousValue == null) { map.put(key, value); } else if (previousValue instanceof List) { // the value is added to the existing list // Note: This is problematic. See header comment! ((List<Object>) previousValue).add(value); } else { // the previous value is replaced by a list containing the previous value and the new value List<Object> list = new ArrayList<Object>(); list.add(previousValue); list.add(value); map.put(key, list); } }
private AbstractMetricFixtureAdapter<?> newMetricFixtureAdapter( MapConfiguration config, OutputStream out, OutputStream err) throws IllegalAccessException, InstantiationException { Preconditions.checkNotNull(config); Preconditions.checkNotNull(out); Preconditions.checkNotNull(err); // All implementations of the MetricFixtureAdapter must have a no-argument // c'tor. LOG.info("Instantiating new metric fixture of class " + config.getString(OPT_ADAPTER_CLASS.getLongOpt())); Class<?> adapterClass = (Class<?>) config.getProperty(ADAPTER_CLASS_CONFIG); Preconditions.checkNotNull(adapterClass); return (AbstractMetricFixtureAdapter<?>) adapterClass.newInstance(); }
if (null == ret.getProperty(OPT_INPUT_MDL.getLongOpt()) ) { throw new ParseException(getName() + " missing MDL file argument"); } else { if (null == ret.getProperty(OPT_INPUT_FIXTURE.getLongOpt()) ) { throw new ParseException(getName() + " missing fixture file argument"); } else { if (null == ret.getProperty(OPT_GENERATE_OUPTUT.getLongOpt()) ) { throw new ParseException(getName() + " missing output file argument");
if (null == ret.getProperty(OPT_INPUT_MDL.getLongOpt()) ) { throw new ParseException("MetricGeneratorTool missing mdl file " + "location"); if (null == ret.getProperty(OPT_INPUT_FIXTURE.getLongOpt()) ) { throw new ParseException("MetricGeneratorTool missing fixture file " + "location"); if (null != ret.getProperty(OPT_INPUT_CONVENTIONS.getLongOpt()) ) { String fileName = ret.getString(OPT_INPUT_CONVENTIONS.getLongOpt()); File file = new File(fileName); if (null == ret.getProperty(OPT_ADAPTER_CLASS.getLongOpt())) { throw new ParseException("MetricGeneratorTool missing adapter class"); } else {