本文整理了Java中io.fabric8.common.util.Objects
类的一些代码示例,展示了Objects
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects
类的具体详情如下:
包路径:io.fabric8.common.util.Objects
类名称:Objects
Objects介绍
[英]Some helper classes for objects comparing and equality
[中]一些用于对象比较和相等的帮助器类
代码示例
代码示例来源: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.hawt/hawtio-watcher-spring-context
/**
* Returns the watcher, throwing an exception if its not configured properly
*/
public WatcherSpringContext watcher() {
Objects.notNull(watcher, "watcher");
return watcher;
}
代码示例来源:origin: io.fabric8/fabric-maven
public int compareTo(DependencyId that) {
int answer = compare(groupId, that.groupId);
if (answer == 0) answer = compare(artifactId, that.artifactId);
if (answer == 0) answer = compare(classifier, that.classifier);
if (answer == 0) answer = compare(extension, that.extension);
return answer;
}
代码示例来源:origin: io.fabric8/fabric-maven
public DependencyId(String groupId, String artifactId, String classifier, String extension) {
this.groupId = groupId;
this.artifactId = artifactId;
this.classifier = classifier;
this.extension = extension;
this.hashCode = Objects.hashCode(groupId, artifactId, classifier, extension);
}
代码示例来源: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: io.fabric8/watcher-core
public void addListener(WatcherListener listener) {
Objects.notNull(listener, "listener");
listeners.add(listener);
}
代码示例来源:origin: io.fabric8/common-util
public static > int compare(List a, List b) {
if (a == b) {
return 0;
}
else if (a == null) {
return -1;
}
else if (b == null) {
return 1;
}
int size = a.size();
int answer = size - b.size();
if (answer == 0) {
for (int i = 0; i answer = compare(a.get(i), b.get(i));
if (answer != 0) {
break;
}
}
}
return answer;
}
代码示例来源: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
public void addListener(WatcherListener listener) {
Objects.notNull(listener, "listener");
listeners.add(listener);
}
代码示例来源:origin: jboss-fuse/fabric8
public static > int compare(List a, List b) {
if (a == b) {
return 0;
}
else if (a == null) {
return -1;
}
else if (b == null) {
return 1;
}
int size = a.size();
int answer = size - b.size();
if (answer == 0) {
for (int i = 0; i answer = compare(a.get(i), b.get(i));
if (answer != 0) {
break;
}
}
}
return answer;
}
代码示例来源: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-rest
@POST
@Path("requirements")
public void setRequirements(FabricRequirements requirements) throws IOException {
Objects.notNull(requirements, "requirements");
FabricService service = getFabricService();
Objects.notNull(service, "FabricService");
service.setRequirements(requirements);
}
代码示例来源:origin: io.fabric8/fabric-agent-commands
@Override
public void invoke(MetaData metadata, Properties resources) {
Map map = metadata.getDesignates();
Map objects = metadata.getObjectClassDefinitions();
Set> entries = map.entrySet();
for (Map.Entry 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: jboss-fuse/fabric8
@POST
@Path("requirements")
public void setRequirements(FabricRequirements requirements) throws IOException {
Objects.notNull(requirements, "requirements");
FabricService service = getFabricService();
Objects.notNull(service, "FabricService");
service.setRequirements(requirements);
}
代码示例来源: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-rest
/**
* Start the container
*/
@POST
@Path("start")
public void start() {
FabricService fabricService = getFabricService();
Objects.notNull(fabricService, "fabricService");
fabricService.startContainer(container);
}
代码示例来源:origin: io.fabric8/fabric-project-deployer
protected static void addMavenDependencies(Map 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 children = dependency.getChildren();
if (children != null) {
for (DependencyDTO child : children) {
addMavenDependencies(artifacts, child);
}
}
}
代码示例来源:origin: io.fabric8/fabric-rest
/**
* Stops the container
*/
@DELETE
@Path("start")
public void stop() {
FabricService fabricService = getFabricService();
Objects.notNull(fabricService, "fabricService");
fabricService.stopContainer(container);
}
代码示例来源: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: jboss-fuse/fabric8
/**
* Start the container
*/
@POST
@Path("start")
public void start() {
FabricService fabricService = getFabricService();
Objects.notNull(fabricService, "fabricService");
fabricService.startContainer(container);
}