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


Java Strings.isNullOrBlank方法代码示例

本文整理汇总了Java中io.fabric8.utils.Strings.isNullOrBlank方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isNullOrBlank方法的具体用法?Java Strings.isNullOrBlank怎么用?Java Strings.isNullOrBlank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.fabric8.utils.Strings的用法示例。


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

示例1: GitRepositoryDTO

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public GitRepositoryDTO(String key, GHRepository repository) {
    this.id = key;
    this.name = repository.getName();
    if (Strings.isNullOrBlank(name)) {
        name = repository.getFullName();
    }
    if (Strings.isNullOrBlank(name)) {
        name = key;
    }
    description = repository.getDescription();
    if (Strings.isNullOrBlank(description) || key.equals(description)) {
        try {
            description = createdAtText(repository.getCreatedAt());
        } catch (IOException e) {
            // ignore
        }
    }
    if (Strings.isNullOrBlank(description)) {
        description = repository.getHomepage();
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:22,代码来源:GitRepositoryDTO.java

示例2: getEmail

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public String getEmail() {
    String email = details.getEmail();
    if (Strings.isNullOrBlank(email)) {
        GHMyself gitMyself = getMyself();
        if (gitMyself != null) {
            try {
                email = gitMyself.getEmail();
                if (Strings.isNullOrBlank(email)) {
                    LOG.warn("No email found on the user settings or GitHub myself, default to invalid address");
                    // github user might have chosen to keep email address private
                    // populate it with invalid address as null is invalid for org.eclipse.jgit.lib.PersonIdent
                    email = "[email protected]";

                }
            } catch (IOException e) {
                LOG.warn("Could not get github.getMyself().getEmail(): " + e, e);
            }
        }
    }
    return email;
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:22,代码来源:GitHubFacade.java

示例3: createRepository

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public GHRepository createRepository(String orgName, String repoName, String description) throws IOException {
    GHCreateRepositoryBuilder builder;
    if (Strings.isNullOrBlank(orgName) || orgName.equals(details.getUsername())) {
        builder = github.createRepository(repoName);
    } else {
        builder = github.getOrganization(orgName).createRepository(repoName);
    }
    // TODO link to the space URL?
    builder.private_(false)
            .homepage("")
            .issues(false)
            .downloads(false)
            .wiki(false);

    if (Strings.isNotBlank(description)) {
        builder.description(description);
    }
    return builder.create();
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:20,代码来源:GitHubFacade.java

示例4: getUserName

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
/**
 * Returns the current users kubernetes/openshift user name
 */
public String getUserName() {
    OpenShiftClient oc = getOpenShiftClientOrNull();
    if (oc != null) {
        User user = oc.users().withName("~").get();
        if (user == null) {
            LOG.warn("Failed to find current logged in user!");
        } else {
            String answer = KubernetesHelper.getName(user);
            if (Strings.isNullOrBlank(answer)) {
                LOG.warn("No name for User " + user);
            } else {
                return answer;
            }
        }
    }

    // TODO needs to use the current token to find the current user name
    return Configs.currentUserName();
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:23,代码来源:KubernetesClientHelper.java

示例5: setArchetypeArtifactId

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
@Override
protected void setArchetypeArtifactId(String archetypeArtifactId) {
    super.setArchetypeArtifactId(archetypeArtifactId);
    if (Strings.isNotBlank(archetypeArtifactId)) {
        if (Strings.isNullOrBlank(getArchetypeVersion())) {
            String version = null;
            if (catalogFactory != null) {
                List<Archetype> archetypes = catalogFactory.getArchetypeCatalog().getArchetypes();
                for (Archetype archetype : archetypes) {
                    if (Objects.equal(archetype.getArtifactId(), archetypeArtifactId)) {
                        version = archetype.getVersion();
                    }
                }
            }
            if (Strings.isNullOrBlank(version)) {
                version = new VersionHelper().getVersion();
            }
            if (version != null) {
                setArchetypeVersion(version);
            } else {
                throw new IllegalArgumentException("Could not find an archetype for id " + archetypeArtifactId
                        + " in the archetype catalog " + catalogFactory);
            }
        }
    }
}
 
开发者ID:fabric8io,项目名称:django,代码行数:27,代码来源:DjangoArchetypeStep.java

示例6: configureBranch

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
protected void configureBranch(Git git, String branch) {
    // lets update the merge config
    if (Strings.isNotBlank(branch)) {
        StoredConfig config = git.getRepository().getConfig();
        if (Strings.isNullOrBlank(config.getString("branch", branch, "remote")) || Strings.isNullOrBlank(config.getString("branch", branch, "merge"))) {
            config.setString("branch", branch, "remote", getRemote());
            config.setString("branch", branch, "merge", "refs/heads/" + branch);
            try {
                config.save();
            } catch (IOException e) {
                LOG.error("Failed to save the git configuration to " + basedir
                        + " with branch " + branch + " on remote repo: " + remoteRepository + " due: " + e.getMessage() + ". This exception is ignored.", e);
            }
        }
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:RepositoryResource.java

示例7: setArchetypeArtifactId

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
@Override
protected void setArchetypeArtifactId(String archetypeArtifactId) {
    super.setArchetypeArtifactId(archetypeArtifactId);
    if (Strings.isNotBlank(archetypeArtifactId)) {
        if (Strings.isNullOrBlank(getArchetypeVersion())) {
            String version = null;
            if (catalogFactory != null) {
                List<Archetype> archetypes = catalogFactory.getArchetypeCatalog().getArchetypes();
                for (Archetype archetype : archetypes) {
                    if (Objects.equal(archetype.getArtifactId(), archetypeArtifactId)) {
                        version = archetype.getVersion();
                    }
                }
            }
            if (Strings.isNullOrBlank(version)) {
                version = VersionHelper.fabric8ArchetypesVersion();
            }
            if (version != null) {
                setArchetypeVersion(version);
            } else {
                throw new IllegalArgumentException("Could not find an archetype for id " + archetypeArtifactId
                        + " in the archetype catalog " + catalogFactory + " or find version for environment variable " + VersionHelper.ENV_FABRIC8_ARCHETYPES_VERSION);
            }
        }
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:27,代码来源:Fabric8ArchetypeCatalogStep.java

示例8: findConnectorName

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
/**
 * Returns the connector name either from an explicit parameter or by taking the first trigger
 */
public String findConnectorName() {
    String answer = getConnectorName();
    if (Strings.isNullOrBlank(answer)) {
        if (funktion != null) {
            List<Flow> flows = notNullList(funktion.getFlows());
            for (Flow flow : flows) {
                List<Step> steps = notNullList(flow.getSteps());
                for (Step step : steps) {
                    if (step instanceof Endpoint) {
                        Endpoint endpoint = (Endpoint) step;
                        String uri = endpoint.getUri();
                        if (Strings.isNotBlank(uri)) {
                            try {
                                return getURIScheme(uri);
                            } catch (URISyntaxException e) {
                                LOG.info("Ignoring parse issue with Endpoint URI: " + uri + ". " + e, e);
                            }
                        }
                    }
                }
            }
        }
    }
    return answer;
}
 
开发者ID:funktionio,项目名称:funktion-connectors,代码行数:29,代码来源:SubscribeRequest.java

示例9: defaultKey

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public void defaultKey(NodeDto owner, Map<String, Integer> nodeCounts) {
    String elementName = getPattern();
    Integer countObject = nodeCounts.get(elementName);
    int count = countObject != null ? countObject : 0;
    nodeCounts.put(elementName, ++count);
    if (Strings.isNullOrBlank(key)) {
        key = owner.getKey();
        if (Strings.isNullOrBlank(key)) {
            key = "";
        } else {
            key += "/";
        }
        if (Strings.isNotBlank(id)) {
            key += id;
        } else {
            key += "_" + elementName + count;
        }
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:NodeDtoSupport.java

示例10: parseCamelContexts

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
protected static List<ContextDto> parseCamelContexts(CamelCatalog camelCatalog, File xmlFile) throws Exception {
    List<ContextDto> camelContexts = new ArrayList<>();

    RouteXml routeXml = new RouteXml();
    XmlModel xmlModel = routeXml.unmarshal(xmlFile);

    // TODO we don't handle multiple contexts inside an XML file!
    CamelContextFactoryBean contextElement = xmlModel.getContextElement();
    String name = contextElement.getId();
    List<RouteDefinition> routeDefs = contextElement.getRoutes();
    ContextDto context = new ContextDto(name);
    camelContexts.add(context);
    String key = name;
    if (Strings.isNullOrBlank(key)) {
        key = "_camelContext" + camelContexts.size();
    }
    context.setKey(key);
    List<NodeDto> routes = createRouteDtos(camelCatalog, routeDefs, context);
    context.setChildren(routes);
    return camelContexts;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:CamelXmlHelper.java

示例11: getIdOrIndex

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
private static String getIdOrIndex(Node node, Map<String, Integer> nodeCounts) {
    String answer = null;
    if (node instanceof Element) {
        Element element = (Element) node;
        String elementName = element.getTagName();
        if ("routes".equals(elementName)) {
            elementName = "camelContext";
        }
        Integer countObject = nodeCounts.get(elementName);
        int count = countObject != null ? countObject.intValue() : 0;
        nodeCounts.put(elementName, ++count);
        answer = element.getAttribute("id");
        if (Strings.isNullOrBlank(answer)) {
            answer = "_" + elementName + count;
        }
    }
    return answer;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:19,代码来源:CamelXmlHelper.java

示例12: getElasticsearchUrl

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public String getElasticsearchUrl() {
    if (!initalised) {
        initalised = true;
        if (Strings.isNotBlank(elasticsearchUrl)) {
            LOG.info("Communicating with Elasticsearch at address: " + elasticsearchUrl);
        } else {
            //LOG.warn("No kubernetes service found for " + ELASTICSEARCH_SERVICE_NAME);
            elasticsearchUrl = "http://" + ELASTICSEARCH_SERVICE_NAME;
            if (Strings.isNullOrBlank(elasticsearchPort)) {
                elasticsearchUrl += ":" + elasticsearchPort;
            }
            if (!elasticsearchUrl.endsWith("/")) {
                elasticsearchUrl = elasticsearchUrl + "/";
            }
        }
    }
    return elasticsearchUrl;
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:19,代码来源:ElasticsearchClient.java

示例13: configureBranch

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
public static void configureBranch(Git git, String branch, String origin, String remoteRepository) {
    // lets update the merge config
    if (!Strings.isNullOrBlank(branch)) {
        StoredConfig config = git.getRepository().getConfig();
        config.setString("branch", branch, "remote", origin);
        config.setString("branch", branch, "merge", "refs/heads/" + branch);

        config.setString("remote", origin, "url", remoteRepository);
        config.setString("remote", origin, "fetch", "+refs/heads/*:refs/remotes/" + origin + "/*");
        try {
            config.save();
        } catch (IOException e) {
            LOG.error("Failed to save the git configuration to " + git.getRepository().getDirectory()
                    + " with branch " + branch + " on " + origin + " remote repo: " + remoteRepository + " due: " + e.getMessage() + ". This exception is ignored.", e);
        }
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:18,代码来源:GitHelpers.java

示例14: processGitRepo

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
/**
 * This method is public for easier unit testing
 */
public int processGitRepo(NamespaceName name, String gitUrl, String gitRef) throws IOException {
    BuildConfig buildConfig = new BuildConfig();
    BuildConfigSpec buildConfigSpec = new BuildConfigSpec();
    buildConfig.setSpec(buildConfigSpec);
    BuildSource buildSource = new BuildSource();
    buildSource.setType("Git");
    GitBuildSource gitSource = new GitBuildSource();
    gitSource.setUri(gitUrl);
    if (Strings.isNullOrBlank(gitRef)) {
        gitRef = "master";
    }
    gitSource.setRef(gitRef);
    buildSource.setGit(gitSource);
    buildConfigSpec.setSource(buildSource);
    return processGitRepo(name, buildConfig, gitSource, gitUrl);
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:20,代码来源:GitBuildConfigProcessor.java

示例15: doPull

import io.fabric8.utils.Strings; //导入方法依赖的package包/类
protected void doPull(File gitFolder, CredentialsProvider cp, String branch, PersonIdent personIdent, UserDetails userDetails) {
    try {
        FileRepositoryBuilder builder = new FileRepositoryBuilder();
        Repository repository = builder.setGitDir(gitFolder)
                .readEnvironment() // scan environment GIT_* variables
                .findGitDir() // scan up the file system tree
                .build();

        Git git = new Git(repository);

        File projectFolder = repository.getDirectory();

        StoredConfig config = repository.getConfig();
        String url = config.getString("remote", userDetails.getRemote(), "url");
        if (Strings.isNullOrBlank(url)) {
            LOG.warn("No remote repository url for " + branch + " defined for the git repository at " + projectFolder.getCanonicalPath() + " so cannot pull");
            //return;
        }
        String mergeUrl = config.getString("branch", branch, "merge");
        if (Strings.isNullOrBlank(mergeUrl)) {
            LOG.warn("No merge spec for branch." + branch + ".merge in the git repository at " + projectFolder.getCanonicalPath() + " so not doing a pull");
            //return;
        }

        LOG.debug("Performing a pull in git repository " + projectFolder.getCanonicalPath() + " on remote URL: " + url);
        PullCommand pull = git.pull();
        GitHelpers.configureCommand(pull, userDetails);
        pull.setRebase(true).call();
    } catch (Throwable e) {
        LOG.error("Failed to pull from the remote git repo with credentials " + cp + " due: " + e.getMessage() + ". This exception is ignored.", e);
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-devops,代码行数:33,代码来源:GitBuildConfigProcessor.java


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