com.offbytwo.jenkins.model.Computer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jenkins-client Show documentation
Show all versions of jenkins-client Show documentation
A Jenkins API client for Java
/*
* Copyright (c) 2013 Rising Oak LLC.
*
* Distributed under the MIT license: http://opensource.org/licenses/MIT
*/
package com.offbytwo.jenkins.model;
import java.io.IOException;
import java.util.List;
import com.google.common.net.UrlEscapers;
public class Computer extends BaseModel {
private String displayName;
public List getComputers() {
return computer;
}
public void setComputer(List computer) {
this.computer = computer;
}
List computer;
public Computer() {
}
public Computer(String displayName) {
this();
this.displayName = displayName;
}
public String getDisplayName() {
return this.displayName;
}
public ComputerWithDetails details() throws IOException {
String name;
if ("master".equals(displayName)) {
name = "(master)";
} else {
name = UrlEscapers.urlPathSegmentEscaper().escape(displayName);
}
return client.get("/computer/" + name, ComputerWithDetails.class);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Computer other = (Computer) obj;
if (computer == null) {
if (other.computer != null)
return false;
} else if (!computer.equals(other.computer))
return false;
if (displayName == null) {
if (other.displayName != null)
return false;
} else if (!displayName.equals(other.displayName))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((computer == null) ? 0 : computer.hashCode());
result = prime * result + ((displayName == null) ? 0 : displayName.hashCode());
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy