001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.hadoop.yarn.api.records.timeline; 020 021import java.util.ArrayList; 022import java.util.List; 023 024import javax.xml.bind.annotation.XmlAccessType; 025import javax.xml.bind.annotation.XmlAccessorType; 026import javax.xml.bind.annotation.XmlElement; 027import javax.xml.bind.annotation.XmlRootElement; 028 029import org.apache.hadoop.classification.InterfaceAudience.Public; 030import org.apache.hadoop.classification.InterfaceStability.Unstable; 031 032/** 033 * The class that hosts a list of timeline domains. 034 */ 035@XmlRootElement(name = "domains") 036@XmlAccessorType(XmlAccessType.NONE) 037@Public 038@Unstable 039public class TimelineDomains { 040 041 private List<TimelineDomain> domains = new ArrayList<TimelineDomain>(); 042 043 public TimelineDomains() { 044 } 045 046 /** 047 * Get a list of domains 048 * 049 * @return a list of domains 050 */ 051 @XmlElement(name = "domains") 052 public List<TimelineDomain> getDomains() { 053 return domains; 054 } 055 056 /** 057 * Add a single domain into the existing domain list 058 * 059 * @param domain 060 * a single domain 061 */ 062 public void addDomain(TimelineDomain domain) { 063 domains.add(domain); 064 } 065 066 /** 067 * All a list of domains into the existing domain list 068 * 069 * @param domains 070 * a list of domains 071 */ 072 public void addDomains(List<TimelineDomain> domains) { 073 this.domains.addAll(domains); 074 } 075 076 /** 077 * Set the domain list to the given list of domains 078 * 079 * @param domains 080 * a list of domains 081 */ 082 public void setDomains(List<TimelineDomain> domains) { 083 this.domains = domains; 084 } 085 086}