本文整理了Java中io.fabric8.common.util.Strings.isEmpty()
方法的一些代码示例,展示了Strings.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.isEmpty()
方法的具体详情如下:
包路径:io.fabric8.common.util.Strings
类名称:Strings
方法名:isEmpty
暂无
代码示例来源:origin: io.fabric8/fabric-project-deployer
private String getVersionOrDefaultVersion(FabricService fabricService, String versionId) {
if (Strings.isEmpty(versionId)) {
versionId = fabricService.getDefaultVersionId();
if (Strings.isEmpty(versionId)) {
versionId = "1.0";
}
}
return versionId;
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
/**
* Returns the maven URL for the artifact without the version
*/
public String toBundleUrlWithoutVersion() {
String prefix = "mvn:";
if ("war".equals(type)) {
prefix = "war:" + prefix;
} else if ("bundle".equals(type)) {
// use bundles
} else if (Strings.isEmpty(type) || "jar".equals(type)) {
prefix = "fab:" + prefix;
}
return prefix + groupId + "/" + artifactId + "/";
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
private String getProfileId(ProjectRequirements requirements) {
String profileId = requirements.getProfileId();
if (Strings.isEmpty(profileId)) {
// lets generate a project based on the group id / artifact id
String groupId = requirements.getGroupId();
String artifactId = requirements.getArtifactId();
if (Strings.isEmpty(groupId)) {
profileId = artifactId;
}
if (Strings.isEmpty(artifactId)) {
profileId = groupId;
} else {
profileId = groupId + "-" + artifactId;
}
}
return profileId;
}
代码示例来源:origin: jboss-fuse/fabric8
public String getSource(String mavenCoords, String className, String filePath) throws IOException {
// the fileName could be just a name and extension so we may have to use the className to make a fully qualified package
String classNamePath = null;
if (!Strings.isEmpty(className)) {
classNamePath = className.replace('.', '/') + ".java";
}
if (Strings.isEmpty(filePath)) {
filePath = classNamePath;
} else {
// we may have package in the className but not in the file name
if (filePath.lastIndexOf('/') <= 0 && classNamePath != null) {
int idx = classNamePath.lastIndexOf('/');
if (idx > 0) {
filePath = classNamePath.substring(0, idx) + ensureStartsWithSlash(filePath);
}
}
}
return getArtifactFile(mavenCoords, filePath, "sources");
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
/**
* Returns the file name of the JSON file stored in the profile for the dependencies
*/
public static String getRequirementsConfigFileName(ProjectRequirements requirements) {
StringBuilder builder = new StringBuilder("dependencies/");
String groupId = requirements.getGroupId();
if (!Strings.isEmpty(groupId)) {
builder.append(groupId);
builder.append("/");
}
String artifactId = requirements.getArtifactId();
if (!Strings.isEmpty(artifactId)) {
builder.append(artifactId);
builder.append("-");
}
builder.append("requirements.json");
return builder.toString();
}
}
代码示例来源:origin: jboss-fuse/fabric8
public static boolean isURIValid(String uriString) {
URI uri = null;
try {
uri = new URI(uriString);
} catch (URISyntaxException e) {
return false;
}
if (!"file".equals(uri.getScheme()) && Strings.isEmpty(uri.getHost())) {
return false;
}
String userInfo = uri.getUserInfo();
String authority = uri.getAuthority();
String hostPort = authority;
if (userInfo != null && hostPort.contains("@")) {
hostPort = hostPort.substring(hostPort.lastIndexOf("@"));
}
if (!"file".equals(uri.getScheme()) && uri.getPort() == -1 && !hostPort.equals(uri.getHost())) {
return false;
}
return true;
}
代码示例来源:origin: io.fabric8.insight/insight-log4j
public static String getMavenCoordinates(String className) {
String coordinates = null;
if (!Strings.isEmpty(className)) {
coordinates = classToMavenCoordMap.get(className);
if (coordinates == null) {
try {
Class cls = findClass(className);
coordinates = getMavenCoordinates(cls);
} catch (Throwable t) {
LOG.debug("Can't find maven coordinate for " + className);
}
}
}
return coordinates;
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public String clusterJson(String clusterPathSegment) throws Exception {
String prefix = "/fabric/registry/clusters";
String path;
if (Strings.isEmpty(clusterPathSegment)) {
path = prefix;
} else {
if (clusterPathSegment.startsWith("/")) {
path = clusterPathSegment;
} else {
path = prefix + "/" + clusterPathSegment;
}
}
Map<String, Object> answer = new HashMap<String, Object>();
CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
ObjectMapper mapper = new ObjectMapper();
addChildrenToMap(answer, path, curator, mapper);
return mapper.writeValueAsString(answer);
}
代码示例来源:origin: io.fabric8.insight/insight-log4j
if (file.exists() && !file.isDirectory()) {
String coordinates = MavenCoordinates.mavenCoordinatesFromJarFile(file);
if (!Strings.isEmpty(coordinates)) {
return coordinates;
代码示例来源:origin: io.fabric8.insight/insight-log4j
buf.append('[');
String mavenCoordinates = MavenCoordHelper.getMavenCoordinates(cls);
if (!Strings.isEmpty(mavenCoordinates)) {
buf.append(mavenCoordinates);
} else {
代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds
void unbindComputeService(ComputeService computeService) {
String name = computeService.getContext().unwrap().getName();
if (!Strings.isEmpty(name)) {
DynamicReference<ComputeService> ref = computeServices.get(name);
if (ref != null) {
ref.unbind(computeService);
}
}
}
}
代码示例来源:origin: io.fabric8/fabric-core-agent-jclouds
void bindComputeService(ComputeService computeService) {
String name = computeService.getContext().unwrap().getName();
if (!Strings.isEmpty(name)) {
computeServices.putIfAbsent(name, new DynamicReference<ComputeService>(name, COMPUTE_SERVICE_WAIT, TimeUnit.MILLISECONDS));
computeServices.get(name).bind(computeService);
}
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
private Profile getOrCreateProfile(Version version, ProjectRequirements requirements) {
String profileId = getProfileId(requirements);
if (Strings.isEmpty(profileId)) {
throw new IllegalArgumentException("No profile ID could be deduced for requirements: " + requirements);
}
// make sure the profileId is valid
FabricValidations.validateProfileName(profileId);
Profile profile;
if (!version.hasProfile(profileId)) {
LOG.info("Creating new profile " + profileId + " version " + version + " for requirements: " + requirements);
String versionId = version.getId();
ProfileService profileService = fabricService.get().adapt(ProfileService.class);
ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId);
profile = profileService.createProfile(builder.getProfile());
} else {
profile = version.getRequiredProfile(profileId);
}
return profile;
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
if (!Strings.isEmpty(webContextPath)) {
Map<String, String> contextPathConfig = new HashMap<>();
Map<String, String> oldValue = profile.getConfiguration(Constants.WEB_CONTEXT_PATHS_PID);
if (!Strings.isEmpty(description)) {
String fileName = "Summary.md";
byte[] data = profile.getFileConfiguration(fileName);
内容来源于网络,如有侵权,请联系作者删除!