/** * Creates a new {@code FileBasedBuilderParametersImpl} object from the * content of the given map. While {@code fromParameters()} expects that an * object already exists and is stored in the given map, this method creates * a new instance based on the content of the map. The map can contain * properties of a {@code FileHandler} and some additional settings which * are stored directly in the newly created object. If the map is * <b>null</b>, an uninitialized instance is returned. * * @param map the map with properties (must not be <b>null</b>) * @return the newly created instance * @throws ClassCastException if the map contains invalid data */ public static FileBasedBuilderParametersImpl fromMap(final Map<String, ?> map) { final FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl(FileHandler.fromMap(map)); if (map != null) { params.setReloadingRefreshDelay((Long) map.get(PROP_REFRESH_DELAY)); params.setReloadingDetectorFactory((ReloadingDetectorFactory) map .get(PROP_DETECTOR_FACTORY)); } return params; }
/** * {@inheritDoc} This implementation takes some properties defined in this * class into account. */ @Override public void inheritFrom(final Map<String, ?> source) { super.inheritFrom(source); final FileBasedBuilderParametersImpl srcParams = fromParameters(source); if (srcParams != null) { setFileSystem(srcParams.getFileHandler().getFileSystem()); setLocationStrategy( srcParams.getFileHandler().getLocationStrategy()); if (srcParams.getFileHandler().getEncoding() != null) { setEncoding(srcParams.getFileHandler().getEncoding()); } if (srcParams.getReloadingDetectorFactory() != null) { setReloadingDetectorFactory( srcParams.getReloadingDetectorFactory()); } if (srcParams.getReloadingRefreshDelay() != null) { setReloadingRefreshDelay(srcParams.getReloadingRefreshDelay()); } } }