org.apache.reef.tang.formats.OptionalParameter Java Examples

The following examples show how to use org.apache.reef.tang.formats.OptionalParameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FileSet.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the file names of this FileSet to the given field of the given ConfigurationModule.
 *
 * @param input the ConfigurationModule to fill out
 * @param field the field to add the files in this set to.
 * @return the filled out ConfigurationModule
 */
ConfigurationModule addNamesTo(final ConfigurationModule input, final OptionalParameter<String> field) {
  ConfigurationModule result = input;
  for (final String fileName : this.fileNames()) {
    result = result.set(field, fileName);
  }
  return result;
}
 
Example #2
Source File: DriverFiles.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Fills out a ConfigurationModule.
 *
 * @param input           The ConfigurationModule to start with.
 * @param globalFileField the field on which to set() the global files.
 * @param globalLibField  the field on which to set() the global libraries.
 * @param localFileField  the field on which to set() the local files.
 * @param localLibField   the field on which to set() the local libraries.
 * @return a copy of input with files and libraries added to the given fields.
 */
public ConfigurationModule addNamesTo(final ConfigurationModule input,
                                      final OptionalParameter<String> globalFileField,
                                      final OptionalParameter<String> globalLibField,
                                      final OptionalParameter<String> localFileField,
                                      final OptionalParameter<String> localLibField) {
  ConfigurationModule result = input;
  result = this.globalFiles.addNamesTo(result, globalFileField);
  result = this.globalLibs.addNamesTo(result, globalLibField);
  result = this.localFiles.addNamesTo(result, localFileField);
  result = this.localLibs.addNamesTo(result, localLibField);
  return result;
}
 
Example #3
Source File: HelloCLR.java    From reef with Apache License 2.0 5 votes vote down vote up
private static ConfigurationModule addAll(final ConfigurationModule conf,
                                          final OptionalParameter<String> param,
                                          final File folder) {
  ConfigurationModule result = conf;
  final File[] files = folder.listFiles();
  if (files != null) {
    for (final File f : files) {
      if (f.canRead() && f.exists() && f.isFile()) {
        result = result.set(param, f.getAbsolutePath());
      }
    }
  }
  return result;
}