本文整理汇总了Java中io.fabric8.utils.Objects类的典型用法代码示例。如果您正苦于以下问题:Java Objects类的具体用法?Java Objects怎么用?Java Objects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Objects类属于io.fabric8.utils包,在下文中一共展示了Objects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
import io.fabric8.utils.Objects; //导入依赖的package包/类
@Override
public int compareTo(BoosterDTO that) {
int answer = Objects.compare(this.runtimeName, that.runtimeName);
if (answer == 0) {
answer = Objects.compare(this.name, that.name);
if (answer == 0) {
answer = Objects.compare(this.missionName, that.missionName);
if (answer == 0) {
answer = Objects.compare(this.missionName, that.missionName);
if (answer == 0) {
answer = Objects.compare(this.id, that.id);
}
}
}
}
return answer;
}
示例2: updateVersions
import io.fabric8.utils.Objects; //导入依赖的package包/类
public void updateVersions(List<DependencyVersionChange> changes, Map<String, String> propertyChanges) {
for (DependencyVersionChange change : changes) {
String scope = change.getScope();
boolean lazyAdd = shouldLazyAdd(change);
if (Objects.equal(MavenScopes.PLUGIN, scope)) {
if (PomHelper.updatePluginVersion(doc, change, propertyChanges, lazyAdd)) {
updated = true;
}
} else {
if (PomHelper.updateDependencyVersion(doc, change, propertyChanges)) {
updated = true;
}
// TODO check for BOM / Parent change too!
}
}
}
示例3: execute
import io.fabric8.utils.Objects; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
String buildConfigName = buildName.getValue();
Objects.assertNotNull(buildConfigName, "buildName");
Map<String, String> labels = BuildConfigs.createBuildLabels(buildConfigName);
String gitUrlText = getOrFindGitUrl(context, gitUri.getValue());
String imageText = image.getValue();
List<EnvVar> envVars = createEnvVars(buildConfigName, gitUrlText, mavenCommand.getValue());
BuildConfig buildConfig = BuildConfigs.createIntegrationTestBuildConfig(buildConfigName, labels, gitUrlText, imageText, envVars);
LOG.info("Generated BuildConfig: " + toJson(buildConfig));
ImageStream imageRepository = BuildConfigs.imageRepository(buildConfigName, labels);
Controller controller = createController();
controller.applyImageStream(imageRepository, "generated ImageStream: " + toJson(imageRepository));
controller.applyBuildConfig(buildConfig, "generated BuildConfig: " + toJson(buildConfig));
return Results.success("Added BuildConfig: " + Builds.getName(buildConfig) + " to OpenShift at master: " + getKubernetes().getMasterUrl());
}
示例4: findPlugin
import io.fabric8.utils.Objects; //导入依赖的package包/类
public static MavenPlugin findPlugin(Project project, String groupId, String artifactId) {
if (project != null) {
MavenPluginFacet pluginFacet = project.getFacet(MavenPluginFacet.class);
if (pluginFacet != null) {
List<MavenPlugin> plugins = pluginFacet.listConfiguredPlugins();
if (plugins != null) {
for (MavenPlugin plugin : plugins) {
Coordinate coordinate = plugin.getCoordinate();
if (coordinate != null) {
if (Objects.equal(groupId, coordinate.getGroupId()) &&
Objects.equal(artifactId, coordinate.getArtifactId())) {
return plugin;
}
}
}
}
}
}
return null;
}
示例5: findCamelNodeForPath
import io.fabric8.utils.Objects; //导入依赖的package包/类
protected static Node findCamelNodeForPath(Node node, String path) {
NodeList childNodes = node.getChildNodes();
if (childNodes != null) {
Map<String, Integer> nodeCounts = new HashMap<>();
for (int i = 0, size = childNodes.getLength(); i < size; i++) {
Node child = childNodes.item(i);
if (child instanceof Element) {
String actual = getIdOrIndex(child, nodeCounts);
if (Objects.equal(actual, path)) {
return child;
}
}
}
}
return null;
}
示例6: createDefaultDownloadStrategy
import io.fabric8.utils.Objects; //导入依赖的package包/类
protected DownloadStrategy createDefaultDownloadStrategy() {
return new DownloadStrategy() {
@Override
public File downloadContent(final OpenMavenURL sourceUrl, final File installDir) throws IOException {
Objects.notNull(sourceUrl, "sourceUrl");
// copy the URL to the install dir
File archive = new File(installDir, INSTALLED_BINARY);
InputStream from = sourceUrl.getInputStream(remoteRepositoryUrls);
if (from == null) {
throw new FileNotFoundException("Could not open URL: " + sourceUrl);
}
copy(from, new FileOutputStream(archive));
return archive;
}
};
}
示例7: substituteEnvironmentVariableExpressions
import io.fabric8.utils.Objects; //导入依赖的package包/类
public static void substituteEnvironmentVariableExpressions(Map<String, String> map, Map<String, String> environmentVariables) {
Set<Map.Entry<String, String>> envEntries = environmentVariables.entrySet();
for (String key : map.keySet()) {
String text = map.get(key);
String oldText = text;
if (Strings.isNotBlank(text)) {
for (Map.Entry<String, String> envEntry : envEntries) {
String envKey = envEntry.getKey();
String envValue = envEntry.getValue();
if (Strings.isNotBlank(envKey) && Strings.isNotBlank(envValue)) {
text = text.replace("${env:" + envKey + "}", envValue);
}
}
if (!Objects.equal(oldText, text)) {
map.put(key, text);
}
}
}
}
示例8: ServiceInstance
import io.fabric8.utils.Objects; //导入依赖的package包/类
public ServiceInstance(Service service) {
this.service = service;
this.id = getName(service);
ServiceSpec spec = KubernetesHelper.getOrCreateSpec(service);
List<ServicePort> ports = spec.getPorts();
if (spec.getPortalIP().equals(HEADLESS_PORTAL_IP)) {
//do nothing service is headless
} else if (ports != null && !ports.isEmpty()) {
for (ServicePort servicePort : ports) {
servicePorts.add(toNamedServicePort(id, servicePort));
}
} else {
throw new IllegalArgumentException("Service: " + id + " doesn't have a valid port configuration.");
}
this.selector = KubernetesHelper.getSelector(service);
Objects.notNull(this.selector, "No selector for service " + id);
if (selector.isEmpty()) {
throw new IllegalArgumentException("Empty selector for service " + id);
}
this.filter = KubernetesHelper.createPodFilter(selector);
// TODO should we use some service metadata to choose the load balancer?
this.loadBalancer = new RoundRobinLoadBalancer();
}
示例9: updatePod
import io.fabric8.utils.Objects; //导入依赖的package包/类
public String updatePod(final @NotNull String podId, final Pod pod) throws Exception {
// TODO needs implementing remotely!
return NodeHelper.excludeFromProcessMonitor(processMonitor, pod, new Callable<String>() {
@Override
public String call() throws Exception {
System.out.println("Updating pod " + pod);
PodSpec desiredState = pod.getSpec();
Objects.notNull(desiredState, "desiredState");
PodStatus currentState = NodeHelper.getOrCreatetStatus(pod);
List<Container> containers = KubernetesHelper.getContainers(pod);
model.updatePod(podId, pod);
return NodeHelper.createMissingContainers(processManager, model, pod, currentState, containers);
}
});
}
示例10: generateArchetypesFromGithubOrganisation
import io.fabric8.utils.Objects; //导入依赖的package包/类
/**
* Iterates through all projects in the given github organisation and generates an archetype for it
*/
public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
GitHub github = GitHub.connectAnonymously();
GHOrganization organization = github.getOrganization(githubOrg);
Objects.notNull(organization, "No github organisation found for: " + githubOrg);
Map<String, GHRepository> repositories = organization.getRepositories();
Set<Map.Entry<String, GHRepository>> entries = repositories.entrySet();
File cloneParentDir = new File(outputDir, "../git-clones");
if (cloneParentDir.exists()) {
Files.recursiveDelete(cloneParentDir);
}
for (Map.Entry<String, GHRepository> entry : entries) {
String repoName = entry.getKey();
GHRepository repo = entry.getValue();
String url = repo.getGitTransportUrl();
generateArchetypeFromGitRepo(outputDir, dirs, cloneParentDir, repoName, url, null);
}
}
示例11: userNamespace
import io.fabric8.utils.Objects; //导入依赖的package包/类
/**
* Returns true if this namespace is a user namespace
*/
public boolean userNamespace() {
if (Strings.isNotBlank(name)) {
return Objects.equal("user", type);
}
return false;
}
示例12: namespacesForType
import io.fabric8.utils.Objects; //导入依赖的package包/类
protected static List<String> namespacesForType(List<NamespaceDTO> namespaces, String type) {
List<String> answer = new ArrayList<>();
if (namespaces != null) {
for (NamespaceDTO namespace : namespaces) {
String name = namespace.getName();
if (Strings.isNotBlank(name)) {
if (Objects.equal(type, namespace.getType())) {
answer.add(namespace.getName());
}
}
}
}
Collections.sort(answer);
return answer;
}
示例13: updateBotCommentCommand
import io.fabric8.utils.Objects; //导入依赖的package包/类
private String updateBotCommentCommand(CommandContext context, GHIssueComment comment) throws IOException {
GHUser user = comment.getUser();
if (user != null) {
if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) {
String body = comment.getBody();
if (body != null) {
body = body.trim();
if (body.startsWith(PullRequests.COMMAND_COMMENT_PREFIX)) {
return body;
}
}
}
}
return null;
}
示例14: hasLabel
import io.fabric8.utils.Objects; //导入依赖的package包/类
public static boolean hasLabel(Collection<GHLabel> labels, String label) {
if (labels != null) {
for (GHLabel ghLabel : labels) {
if (Objects.equal(label, ghLabel.getName())) {
return true;
}
}
}
return false;
}
示例15: updateBotIssuePendingChangesComment
import io.fabric8.utils.Objects; //导入依赖的package包/类
public static String updateBotIssuePendingChangesComment(CommandContext context, GHIssueComment comment) throws IOException {
GHUser user = comment.getUser();
if (user != null) {
if (Objects.equal(context.getConfiguration().getGithubUsername(), user.getLogin())) {
String body = comment.getBody();
if (body != null) {
body = body.trim();
if (body.startsWith(PENDING_CHANGE_COMMENT_PREFIX)) {
return body;
}
}
}
}
return null;
}