@Override
	public ModuleOptions interpolate(final Map<String, String> raw) throws BindException {
		MapBindingResult bindingResult = new MapBindingResult(new HashMap<String, String>(), "options");
		for (String provided : raw.keySet()) {
			if (!options.containsKey(provided)) {
				bindingResult.addError(new FieldError("options", provided, String.format(
						"Module option '%s' does not exist", provided)));
			}
		}

		if (bindingResult.hasErrors()) {
			throw new BindException(bindingResult);
		}
		ModuleOptions moduleOptions = new ModuleOptions() {

			@Override
			public EnumerablePropertySource<?> asPropertySource() {
				// Return a property source with only the intersection
				// between declared properties and actual provided values
				return new EnumerablePropertySource<Object>(this.toString(), this) {

					@Override
					public Object getProperty(String name) {
						ModuleOption option = options.get(name);
						if (option != null) {
							String provided = raw.get(name);
							if (provided != null) {
								validateByType(option, provided);
								return provided;
							}
							else {
								return option.getDefaultValue();
							}
						} // option is not in the allowed list
						else {
							return null;
						}
					}

					@Override
					public String[] getPropertyNames() {
						return options.keySet().toArray(new String[options.size()]);
					}
				};
			}
		};

		// Validate option values
		PropertySource<?> ps = moduleOptions.asPropertySource();
		for (String name : options.keySet()) {
			ps.getProperty(name);
		}
		return moduleOptions;
	}
An implementation of {@link ModuleOptionsMetadata} that only knows how to list options and does not support advanced
facilities such as derived options, profile activation or validation.

@author Eric Bottard
@author David Turanski
spring-xd-module/src/main/java/org/springframework/xd/module/options/SimpleModuleOptionsMetadata.java