public DoubleSizeConstraint(OperationContext context, Storage storage) throws InvalidInputException { super(context, storage, Double.class); this.minSize = storage.get(KEY_MIN_SIZE, Double.class, -1.0); this.maxSize = storage.get(KEY_MAX_SIZE, Double.class, -1.0); if (minSize == -1 && maxSize == -1) { throw new InvalidInputException("Neither min-size nor max-size is set."); } else if (maxSize != -1 && maxSize < minSize) { throw new InvalidInputException( "Max length is smaller than min length. (min: " + minSize + " max: " + maxSize + ")"); } }
public static OrderProperties create( PropertyModule propertyModule, Module module, String fileName) throws DataFileException { PropertyFactory propertyFactory = propertyModule.getPropertyFactory(); Storage configuration = Properties.getPropertiesConfiguration( propertyModule.getConversionModule(), module, fileName); return new OrderProperties( propertyModule, propertyFactory.createProperty(configuration.getStorage("index", true), Integer.class), propertyFactory.createProperty( configuration.getStorage("category", true), OrderCategory.class), propertyFactory.createProperty(configuration.getStorage("customer", true), Customer.class), propertyFactory.createProperty(configuration.getStorage("description", true), String.class), propertyFactory.createMapProperty( configuration.getStorage("products", true), HashMap.class, Product.class, Integer.class), propertyFactory.createProperty( configuration.getStorage("invoice-date", true), LocalDate.class), propertyFactory.createProperty( configuration.getStorage("paid-date", true), LocalDate.class), propertyFactory.createProperty(configuration.getStorage("quarter", true), Integer.class)); }
@Override public Map<String, Object> getContents() { return storage.getContents(); }