本文整理了Java中io.fabric8.utils.Strings.stripSuffix()
方法的一些代码示例,展示了Strings.stripSuffix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.stripSuffix()
方法的具体详情如下:
包路径:io.fabric8.utils.Strings
类名称:Strings
方法名:stripSuffix
暂无
代码示例来源:origin: io.fabric8.updatebot/updatebot-core
public GitRepository(String name, String cloneUrl) {
this.name = name;
this.cloneUrl = cloneUrl;
this.htmlUrl = Strings.stripSuffix(cloneUrl, ".git");
}
代码示例来源:origin: io.jenkins.updatebot/updatebot-core
public GitRepository(String name, String cloneUrl) {
this.name = name;
this.cloneUrl = cloneUrl;
this.htmlUrl = Strings.stripSuffix(cloneUrl, ".git");
}
代码示例来源:origin: io.fabric8/fabric8-arquillian
private SortedMap<String, File> findLogFiles(File logDir, String name) {
SortedMap<String, File> answer = new TreeMap<>();
File[] files = logDir.listFiles();
if (files != null) {
for (File file : files) {
String fileName = file.getName();
if (fileName.endsWith(LogHelpers.LOG_FILE_POSTFIX)) {
fileName = Strings.stripSuffix(fileName, LogHelpers.LOG_FILE_POSTFIX);
if (fileName.startsWith(name)) {
answer.put(fileName, file);
}
}
}
}
return answer;
}
代码示例来源:origin: io.fabric8.updatebot/updatebot-core
protected static String stripSlashesAndGit(String path) {
path = Strings.stripPrefix(path, "/");
path = Strings.stripPrefix(path, "/");
path = Strings.stripSuffix(path, "/");
path = Strings.stripSuffix(path, ".git");
return path;
}
代码示例来源:origin: io.fabric8.forge/camel-tooling-util
/**
* Returns the pattern name
*/
public static String getPatternName(OptionalIdentifiedDefinition camelNode) {
// we should grab the annotation instead
XmlRootElement root = camelNode.getClass().getAnnotation(XmlRootElement.class);
if (root != null) {
return root.name();
}
String simpleName = Strings.stripSuffix(camelNode.getClass().getSimpleName(), "Definition");
return Introspector.decapitalize(simpleName);
}
代码示例来源:origin: io.jenkins.updatebot/updatebot-core
protected static String stripSlashesAndGit(String path) {
path = Strings.stripPrefix(path, "/");
path = Strings.stripPrefix(path, "/");
path = Strings.stripSuffix(path, "/");
path = Strings.stripSuffix(path, ".git");
return path;
}
代码示例来源:origin: io.fabric8/fabric-utils
public OpenShiftSPI() {
Map<String, String> envs = System.getenv();
for (Map.Entry<String, String> entry : envs.entrySet()) {
String key = entry.getKey();
String publicPort = entry.getValue();
if (key.startsWith("OPENSHIFT_") && key.endsWith("_PROXY_PORT")) {
String prefix = Strings.stripSuffix(key, "_PROXY_PORT");
String privatePort = envs.get(prefix + "_PORT");
if (privatePort == null) {
privatePort = envs.get(prefix);
}
if (privatePort != null) {
try {
ports.put(new Integer(privatePort), new Integer(publicPort));
} catch (NumberFormatException ignore) {
}
}
}
}
}
代码示例来源:origin: io.fabric8/fabric8-devops
protected void extractOrganisationAndUserFromUrl() {
if (Strings.isNotBlank(url)) {
String text = Strings.stripSuffix(url, "./");
text = Strings.stripSuffix(text, ".git");
text = Strings.stripSuffix(text, "/");
String[] split = text.split("/");
if (split != null && split.length > 1) {
if (Strings.isNullOrBlank(user)) {
user = split[split.length - 2];
}
if (Strings.isNullOrBlank(repoName)) {
repoName = split[split.length - 1];
}
}
}
}
代码示例来源:origin: fabric8io/ipaas-quickstarts
protected void validatePom(String projectName, File pom) {
LOG.debug("Validating " + pom);
String prefix = "quickstart " + Strings.stripSuffix(projectName, "-archetype") + " pom.xml";
Element root = null;
try {
Document doc = archetypeUtils.parseXml(new InputSource(new FileReader(pom)));
root = doc.getDocumentElement();
} catch (Exception e) {
LOG.error("Failed to parse " + pom + ". " + e, e);
return;
}
if (root == null) {
return;
}
Element propertyElement = getPropertiesElement(root);
// lets load all the properties defined in the <properties> element in the bom pom.
NodeList dependencyElements = root.getElementsByTagName("dependency");
for (int i = 0, size = dependencyElements.getLength(); i < size; i++) {
Element dependency = (Element) dependencyElements.item(i);
validateVersion(prefix + " dependency", dependency, propertyElement);
}
NodeList pluginElements = root.getElementsByTagName("plugin");
for (int i = 0, size = pluginElements.getLength(); i < size; i++) {
Element plugin = (Element) pluginElements.item(i);
validateVersion(prefix + " plugin", plugin, propertyElement);
}
}
代码示例来源:origin: io.fabric8/fabric8-arquillian
public static Route createRouteForService(String routeDomainPostfix, String namespace, Service service, Logger log) {
Route route = null;
String id = KubernetesHelper.getName(service);
if (Strings.isNotBlank(id) && shouldCreateRouteForService(log, service, id)) {
route = new Route();
String routeId = id;
KubernetesHelper.setName(route, namespace, routeId);
RouteSpec routeSpec = new RouteSpec();
RouteTargetReference objectRef = new RouteTargetReferenceBuilder().withName(id).build();
//objectRef.setNamespace(namespace);
routeSpec.setTo(objectRef);
if (Strings.isNotBlank(routeDomainPostfix)) {
// Let Openshift determine the route host when the domain is not set
String host = Strings.stripSuffix(Strings.stripSuffix(id, "-service"), ".");
String namespaceSuffix = "-" + namespace;
routeSpec.setHost(host + namespaceSuffix + "." + Strings.stripPrefix(routeDomainPostfix, "."));
}
route.setSpec(routeSpec);
String json = null;
try {
json = KubernetesHelper.toJson(route);
} catch (JsonProcessingException e) {
json = e.getMessage() + ". object: " + route;
}
}
return route;
}
内容来源于网络,如有侵权,请联系作者删除!