本文整理了Java中io.fabric8.common.util.Objects.equal()
方法的一些代码示例,展示了Objects.equal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.equal()
方法的具体详情如下:
包路径:io.fabric8.common.util.Objects
类名称:Objects
方法名:equal
暂无
代码示例来源:origin: io.fabric8/fabric-maven
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof DependencyId) {
DependencyId that = (DependencyId) o;
return this.hashCode() == that.hashCode() &&
equal(groupId, that.groupId) &&
equal(artifactId, that.artifactId) &&
equal(classifier, that.classifier) &&
equal(extension, that.extension);
}
return false;
}
代码示例来源:origin: io.fabric8/fabric-zookeeper
public void setStringData(String zkPath, String data, CreateMode createMode) throws Exception {
String currentValue = cache.get(data);
if (currentValue == null || !Objects.equal(currentValue, data)) {
ZooKeeperUtils.setData(curator, zkPath, data, createMode);
cache.put(zkPath, data);
}
}
代码示例来源:origin: jboss-fuse/fabric8
public void setStringData(String zkPath, String data, CreateMode createMode) throws Exception {
String currentValue = cache.get(data);
if (currentValue == null || !Objects.equal(currentValue, data)) {
ZooKeeperUtils.setData(curator, zkPath, data, createMode);
cache.put(zkPath, data);
}
}
代码示例来源:origin: jboss-fuse/fabric8
/**
* Tries to find the host alias for the given container by matching on local and public host names and IP addresses etc
*/
protected static String findHostAlias(Collection<? extends HostConfiguration> hostConfigurations, Container container) {
for (HostConfiguration config : hostConfigurations) {
String hostName = config.getHostName();
if (Objects.equal(hostName, container.getLocalHostname()) ||
Objects.equal(hostName, container.getLocalIp()) ||
Objects.equal(hostName, container.getPublicHostname()) ||
Objects.equal(hostName, container.getIp()) ||
Objects.equal(hostName, container.getManualIp())) {
return hostName;
}
}
return null;
}
代码示例来源:origin: io.fabric8/fabric-agent-commands
@Override
public void invoke(MetaData metadata, Properties resources) {
Map<String, Object> map = metadata.getDesignates();
Map<String, Object> objects = metadata.getObjectClassDefinitions();
Set<Map.Entry<String, Object>> entries = map.entrySet();
for (Map.Entry<String, Object> entry : entries) {
String aPid = entry.getKey();
Object value = objects.get(aPid);
if (Objects.equal(pid, aPid) && value instanceof OCD) {
OCD ocd = (OCD) value;
answer.set(createMetaTypeObjectDTO(resources, ocd));
}
}
}
};
代码示例来源:origin: io.fabric8/fabric-openshift
/**
* We usually need to either comment out the WAR plugin or at least update its
* destination file name
*/
protected void updateWarPlugin(Element plugins) throws XPathExpressionException {
Element plugin = getPlugin(plugins, "maven-war-plugin");
if (plugin != null) {
Element warName = xpath("configuration/warName").element(plugin);
if (warName != null) {
String textContent = warName.getTextContent();
if (Objects.equal("ROOT", textContent)) {
// lets overwrite the local build from being the root web app
warName.setTextContent(buildWarName);
}
}
}
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
protected static void addMavenDependencies(Map<String, Parser> artifacts, DependencyDTO dependency) throws MalformedURLException {
String url = dependency.toBundleUrlWithType();
Parser parser = Parser.parsePathWithSchemePrefix(url);
String scope = dependency.getScope();
if (!artifacts.containsKey(url) && !artifacts.containsValue(parser) && !(Objects.equal("test", scope))) {
LOGGER.debug("Adding url: " + url + " parser: " + parser);
artifacts.put(url, parser);
}
List<DependencyDTO> children = dependency.getChildren();
if (children != null) {
for (DependencyDTO child : children) {
addMavenDependencies(artifacts, child);
}
}
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
/**
* Registers the given jolokia URL for the given container if its not null
*
* @param container the container to register the jolokia URL for
* @param jolokiaUrl the Jolokia URL
*/
public static void registerJolokiaUrl(Container container, String jolokiaUrl) {
if (Strings.isNotBlank(jolokiaUrl)) {
String currentUrl = container.getJolokiaUrl();
if (!Objects.equal(jolokiaUrl, currentUrl)) {
container.setJolokiaUrl(jolokiaUrl);
}
}
}
}
代码示例来源:origin: io.fabric8/fabric-openshift
/**
* Lets add/update the maven dependency plugin configuration to copy deployments
* to the deployDir or the webAppDir
*/
protected void updateDependencyPlugin(Element plugins, Element dependencies, Collection<Parser> artifacts) throws XPathExpressionException {
Element plugin = getOrCreatePlugin(plugins, "maven-dependency-plugin", "2.8");
Element executions = getOrCreateChild(plugin, "executions", 6);
List<Parser> warArtifacts = new ArrayList<Parser>();
List<Parser> jarArtifacts = new ArrayList<Parser>();
for (Parser artifact : artifacts) {
String type = artifact.getType();
if (Objects.equal("war", type)) {
warArtifacts.add(artifact);
} else {
jarArtifacts.add(artifact);
}
}
if (Strings.isNotBlank(webAppDir) && !warArtifacts.isEmpty()) {
recreateDependencyExecution(executions, dependencies, "fuse-fabric-deploy-webapps", webAppDir, warArtifacts, true);
}
if (Strings.isNotBlank(deployDir) && !jarArtifacts.isEmpty()) {
recreateDependencyExecution(executions, dependencies, "fuse-fabric-deploy-shared", deployDir, jarArtifacts, false);
}
}
代码示例来源:origin: jboss-fuse/fabric8
if (Objects.equal(protocol, urlProtocol)) {
Handler<AsyncResult<NetSocket>> handler = new Handler<AsyncResult<NetSocket>>() {
public void handle(final AsyncResult<NetSocket> asyncSocket) {
代码示例来源:origin: io.fabric8/fabric-openshift
protected void addMavenCoordinates(Element owner, Parser parser, int indent) {
String group = groupId(parser);
createAndAppendChild(owner, "groupId", indent, group);
createAndAppendChild(owner, "artifactId", indent, parser.getArtifact());
createAndAppendChild(owner, "version", indent, parser.getVersion());
String type = parser.getType();
if (type != null && !Objects.equal("jar", type)) {
createAndAppendChild(owner, "type", indent, type);
}
String classifier = parser.getClassifier();
if (Strings.isNotBlank(classifier)) {
createAndAppendChild(owner, "classifier", indent, classifier);
}
}
代码示例来源:origin: io.fabric8/fabric-openshift
protected void addOrUpdateDependency(Element dependencies, Parser parser) throws XPathExpressionException {
String group = groupId(parser);
String artifact = parser.getArtifact();
String xpath = "dependency[groupId = '" + group + "' and artifactId = '" + artifact + "'";
String type = parser.getType();
if (Strings.isNotBlank(type) && !Objects.equal("jar", type)) {
xpath += " and type='" + type + "'";
}
String classifier = parser.getClassifier();
if (Strings.isNotBlank(classifier)) {
xpath += " and classifier='" + classifier + "'";
}
xpath += "]";
String scope = "provided";
Element dependency = xpath(xpath).element(dependencies);
if (dependency != null) {
// lets preserve the scope or not add it if there is no scope
// on the previously found dependency
scope = xpath("scope").elementTextContent(dependency);
detachElement(dependency);
}
dependency = createAndAppendChild(dependencies, "dependency", 2);
addMavenCoordinates(dependency, parser, 3);
if (Strings.isNotBlank(scope)) {
createAndAppendChild(dependency, "scope", 3, scope);
}
}
内容来源于网络,如有侵权,请联系作者删除!