当前位置: 首页>>代码示例>>Java>>正文


Java Required类代码示例

本文整理汇总了Java中org.apache.beam.sdk.options.Validation.Required的典型用法代码示例。如果您正苦于以下问题:Java Required类的具体用法?Java Required怎么用?Java Required使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Required类属于org.apache.beam.sdk.options.Validation包,在下文中一共展示了Required类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prettyPrintRequiredGroups

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
/**
 * Output the requirement groups that the property is a member of, including all properties that
 * satisfy the group requirement, breaking up long lines on white space characters and attempting
 * to honor a line limit of {@code TERMINAL_WIDTH}.
 */
private static void prettyPrintRequiredGroups(PrintStream out, Required annotation,
    SortedSetMultimap<String, String> requiredGroupNameToProperties) {
  if (annotation == null || annotation.groups() == null) {
    return;
  }
  for (String group : annotation.groups()) {
    SortedSet<String> groupMembers = requiredGroupNameToProperties.get(group);
    String requirement;
    if (groupMembers.size() == 1) {
      requirement = Iterables.getOnlyElement(groupMembers) + " is required.";
    } else {
      requirement = "At least one of " + groupMembers + " is required";
    }
    terminalPrettyPrint(out, requirement.split("\\s+"));
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:22,代码来源:PipelineOptionsFactory.java

示例2: getRequiredGroupNamesToProperties

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
/**
 * Returns a map of required groups of arguments to the properties that satisfy the requirement.
 */
private static SortedSetMultimap<String, String> getRequiredGroupNamesToProperties(
    Map<String, Method> propertyNamesToGetters) {
  SortedSetMultimap<String, String> result = TreeMultimap.create();
  for (Map.Entry<String, Method> propertyEntry : propertyNamesToGetters.entrySet()) {
    Required requiredAnnotation =
        propertyEntry.getValue().getAnnotation(Validation.Required.class);
    if (requiredAnnotation != null) {
      for (String groupName : requiredAnnotation.groups()) {
        result.put(groupName, propertyEntry.getKey());
      }
    }
  }
  return result;
}
 
开发者ID:apache,项目名称:beam,代码行数:18,代码来源:PipelineOptionsFactory.java

示例3: getSqlAddressFromLauncher

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server address reachable from the launcher machine")
@Required
String getSqlAddressFromLauncher();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:4,代码来源:MsSqlMigrator.java

示例4: getSqlAddressFromPipeline

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server address reachable from the pipeline")
@Required
String getSqlAddressFromPipeline();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:4,代码来源:MsSqlMigrator.java

示例5: getSqlPort

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server port number")
@Default.Integer(1433)
@Required
Integer getSqlPort();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:5,代码来源:MsSqlMigrator.java

示例6: getSqlCatalog

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server source catalog name")
@Required
String getSqlCatalog();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:4,代码来源:MsSqlMigrator.java

示例7: getSqlUsername

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server username")
@Default.String("migrator")
@Required
String getSqlUsername();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:5,代码来源:MsSqlMigrator.java

示例8: getSqlPassword

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server password")
@Required
String getSqlPassword();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:4,代码来源:MsSqlMigrator.java

示例9: getBigQueryDataset

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("BigQuery dataset name")
@Required
String getBigQueryDataset();
 
开发者ID:favsto,项目名称:sql-to-bigquery-dataflow,代码行数:4,代码来源:MsSqlMigrator.java

示例10: getOutput

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
/**
 * Set this required option to specify where to write the output.
 */
@Description("Path of the file to write to")
@Required
String getOutput();
 
开发者ID:apache,项目名称:beam,代码行数:7,代码来源:WordCount.java

示例11: printHelp

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
/**
 * Outputs the set of options available to be set for the passed in {@link PipelineOptions}
 * interface. The output is in a human readable format. The format is:
 * <pre>
 * OptionGroup:
 *     ... option group description ...
 *
 *  --option1={@code <type>} or list of valid enum choices
 *     Default: value (if available, see {@link Default})
 *     ... option description ... (if available, see {@link Description})
 *     Required groups (if available, see {@link Required})
 *  --option2={@code <type>} or list of valid enum choices
 *     Default: value (if available, see {@link Default})
 *     ... option description ... (if available, see {@link Description})
 *     Required groups (if available, see {@link Required})
 * </pre>
 * This method will attempt to format its output to be compatible with a terminal window.
 */
public static void printHelp(PrintStream out, Class<? extends PipelineOptions> iface) {
  checkNotNull(out);
  checkNotNull(iface);
  validateWellFormed(iface, REGISTERED_OPTIONS);

  Set<PipelineOptionSpec> properties =
      PipelineOptionsReflector.getOptionSpecs(iface);

  RowSortedTable<Class<?>, String, Method> ifacePropGetterTable = TreeBasedTable.create(
      ClassNameComparator.INSTANCE, Ordering.natural());
  for (PipelineOptionSpec prop : properties) {
    ifacePropGetterTable.put(prop.getDefiningInterface(), prop.getName(), prop.getGetterMethod());
  }

  for (Map.Entry<Class<?>, Map<String, Method>> ifaceToPropertyMap :
      ifacePropGetterTable.rowMap().entrySet()) {
    Class<?> currentIface = ifaceToPropertyMap.getKey();
    Map<String, Method> propertyNamesToGetters = ifaceToPropertyMap.getValue();

    SortedSetMultimap<String, String> requiredGroupNameToProperties =
        getRequiredGroupNamesToProperties(propertyNamesToGetters);

    out.format("%s:%n", currentIface.getName());
    prettyPrintDescription(out, currentIface.getAnnotation(Description.class));

    out.println();

    List<String> lists = Lists.newArrayList(propertyNamesToGetters.keySet());
    Collections.sort(lists, String.CASE_INSENSITIVE_ORDER);
    for (String propertyName : lists) {
      Method method = propertyNamesToGetters.get(propertyName);
      String printableType = method.getReturnType().getSimpleName();
      if (method.getReturnType().isEnum()) {
        printableType = Joiner.on(" | ").join(method.getReturnType().getEnumConstants());
      }
      out.format("  --%s=<%s>%n", propertyName, printableType);
      Optional<String> defaultValue = getDefaultValueFromAnnotation(method);
      if (defaultValue.isPresent()) {
        out.format("    Default: %s%n", defaultValue.get());
      }
      prettyPrintDescription(out, method.getAnnotation(Description.class));
      prettyPrintRequiredGroups(out, method.getAnnotation(Validation.Required.class),
          requiredGroupNameToProperties);
    }
    out.println();
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:66,代码来源:PipelineOptionsFactory.java

示例12: getOutput

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
/**
 * Set this option to specify where to write the output, default is /tmp/output.
 * The output directory should not exist on HDFS.
 */
@Description("Path of the file to write to")
@Required
@Default.String("/tmp/output/")
String getOutput();
 
开发者ID:tweise,项目名称:apex-samples,代码行数:9,代码来源:Application.java

示例13: getBigtableInstanceId

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Required
@Description("The Google Cloud Bigtable instance ID .")
String getBigtableInstanceId();
 
开发者ID:GoogleCloudPlatform,项目名称:cloud-bigtable-examples,代码行数:4,代码来源:JobOptions.java

示例14: getBigtableTableId

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Required
@Description("The Cloud Bigtable table ID in the instance." )
String getBigtableTableId();
 
开发者ID:GoogleCloudPlatform,项目名称:cloud-bigtable-examples,代码行数:4,代码来源:JobOptions.java

示例15: getVariantSetId

import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Required
@Description("The ID of the Google Genomics variant set this pipeline is accessing.")
String getVariantSetId();
 
开发者ID:googlegenomics,项目名称:dataflow-java,代码行数:4,代码来源:CallSetNamesOptions.java


注:本文中的org.apache.beam.sdk.options.Validation.Required类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。