本文整理汇总了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+"));
}
}
示例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;
}
示例3: getSqlAddressFromLauncher
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server address reachable from the launcher machine")
@Required
String getSqlAddressFromLauncher();
示例4: getSqlAddressFromPipeline
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server address reachable from the pipeline")
@Required
String getSqlAddressFromPipeline();
示例5: getSqlPort
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server port number")
@Default.Integer(1433)
@Required
Integer getSqlPort();
示例6: getSqlCatalog
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server source catalog name")
@Required
String getSqlCatalog();
示例7: getSqlUsername
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server username")
@Default.String("migrator")
@Required
String getSqlUsername();
示例8: getSqlPassword
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("MS SQL Server password")
@Required
String getSqlPassword();
示例9: getBigQueryDataset
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Description("BigQuery dataset name")
@Required
String getBigQueryDataset();
示例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();
示例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();
}
}
示例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();
示例13: getBigtableInstanceId
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Required
@Description("The Google Cloud Bigtable instance ID .")
String getBigtableInstanceId();
示例14: getBigtableTableId
import org.apache.beam.sdk.options.Validation.Required; //导入依赖的package包/类
@Required
@Description("The Cloud Bigtable table ID in the instance." )
String getBigtableTableId();
示例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();