本文整理汇总了Java中jetbrains.buildServer.util.StringUtil.nullIfEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.nullIfEmpty方法的具体用法?Java StringUtil.nullIfEmpty怎么用?Java StringUtil.nullIfEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jetbrains.buildServer.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.nullIfEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VmwareCloudImageDetails
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public VmwareCloudImageDetails(@NotNull final CloudImageParameters imageParameters){
myCustomizationSpec = imageParameters.getParameter(VmwareConstants.CUSTOMIZATION_SPEC);
myMaxInstances = StringUtil.parseInt(StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.MAX_INSTANCES)), 0);
mySourceVmName = imageParameters.getParameter(VmwareConstants.SOURCE_VM_NAME);
myFolderId = imageParameters.getParameter(VmwareConstants.FOLDER);
myResourcePoolId = imageParameters.getParameter(VmwareConstants.RESOURCE_POOL);
myCloneBehaviour = CloneBehaviour.valueOf(imageParameters.getParameter(VmwareConstants.BEHAVIOUR));
mySnapshotName = StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.SNAPSHOT));
myNickname = StringUtil.nullIfEmpty(imageParameters.getParameter(VmwareConstants.NICKNAME));
myAgentPoolId = imageParameters.getAgentPoolId();
if (myCloneBehaviour.isUseOriginal()){
mySourceId = mySourceVmName;
} else {
mySourceId = myNickname == null ? mySourceVmName : myNickname;
}
}
示例2: uploadToBucket
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public void uploadToBucket(String bucketName, AmazonS3 s3Client, File file, String destinationDir, String cacheControlString) throws AmazonClientException {
String key = StringUtil.nullIfEmpty(destinationDir) == null ? file.getName() : destinationDir + "/" + file.getName();
PutObjectRequest request = new PutObjectRequest(
bucketName, key, file);
if (cacheControlString != null) {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setCacheControl(cacheControlString);
request.withMetadata(objectMetadata);
}
s3Client.putObject(request);
}
示例3: createModel
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public @NotNull AgentRunnerBuildParametersModel createModel(@NotNull final Map<String, String> runnerParameters) {
final String bucketName = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_BUCKET_NAME));
final String credentialsPublicKey = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_CREDENTIALS_PUB_KEY));
final String credentialsPrivateKey = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_CREDENTIALS_PRIVATE_KEY));
final String sourcePaths = runnerParameters.get(PluginConstants.UI_PARAM_CONTENT_PATHS);
final boolean needToEmptyBucket = Boolean.valueOf(runnerParameters.get(PluginConstants.UI_PARAM_EMPTY_BUCKET));
final String httpHeaderCacheControl = StringUtil.nullIfEmpty(StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_HTTP_HEADERS_CACHE_CONTROL)));
final String httpProxy = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_HTTP_PROXY));
return new AgentRunnerBuildParametersModel(bucketName, credentialsPublicKey, credentialsPrivateKey, needToEmptyBucket, sourcePaths, httpHeaderCacheControl, httpProxy);
}
示例4: getFilterFromRequest
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
protected Filter getFilterFromRequest(@NotNull final HttpServletRequest request) throws IncompleteFilterException {
String id = StringUtil.nullIfEmpty(request.getParameter(DEBREPO_FILTER_ID));
String regex = getParameterAsStringOrNull(request, DEBREPO_FILTER_REGEX, "The Regex field must not be empty");
String dist = getParameterAsStringOrNull(request, DEBREPO_FILTER_DIST, "The dist field must not be empty");
String component = getParameterAsStringOrNull(request, DEBREPO_FILTER_COMPONENT, "The component field must not be empty");
if (id == null || "_new".equals(id) || "_copy".equals(id)){
return new Filter(regex, dist, component);
}
return new Filter(id, regex, dist, component);
}
示例5: getParameterAsStringOrNull
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public String getParameterAsStringOrNull(HttpServletRequest request, String paramName, String errorMessage) throws IncompleteFilterException {
String returnValue = StringUtil.nullIfEmpty(request.getParameter(paramName));
if (returnValue == null || "".equals(returnValue.trim())) {
throw new IncompleteFilterException(errorMessage);
}
return returnValue;
}