com.cloudbees.api.config.Environment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudbees-api-client Show documentation
Show all versions of cloudbees-api-client Show documentation
The CloudBees API Client library for Java
/*
* Copyright 2010-2011, CloudBees Inc.
*/
package com.cloudbees.api.config;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import java.lang.String;import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author Fabian Donze
*/
@XStreamAlias("env")
public class Environment extends ParameterHolder {
@XStreamAsAttribute
private String name;
@XStreamImplicit(itemFieldName = "resource")
private List resources;
public Environment() {
}
public Environment(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List getResources() {
if (resources == null)
resources = new ArrayList();
return resources;
}
public void setResources(List resources) {
this.resources = resources;
}
public void setResource(ResourceSettings resource) {
deleteResource(resource.getName());
getResources().add(resource);
}
public ResourceSettings getResource(String name) {
for (ResourceSettings resource : getResources()) {
if (resource.getName().equals(name))
return resource;
}
return null;
}
public void deleteResource(String name) {
Iterator it = getResources().iterator();
while (it.hasNext()) {
if (it.next().getName().equals(name)) {
it.remove();
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy