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.Evolving; 031 032/** 033 * The class that hosts a list of timeline entities. 034 */ 035@XmlRootElement(name = "entities") 036@XmlAccessorType(XmlAccessType.NONE) 037@Public 038@Evolving 039public class TimelineEntities { 040 041 private List<TimelineEntity> entities = 042 new ArrayList<TimelineEntity>(); 043 044 public TimelineEntities() { 045 046 } 047 048 /** 049 * Get a list of entities 050 * 051 * @return a list of entities 052 */ 053 @XmlElement(name = "entities") 054 public List<TimelineEntity> getEntities() { 055 return entities; 056 } 057 058 /** 059 * Add a single entity into the existing entity list 060 * 061 * @param entity 062 * a single entity 063 */ 064 public void addEntity(TimelineEntity entity) { 065 entities.add(entity); 066 } 067 068 /** 069 * All a list of entities into the existing entity list 070 * 071 * @param entities 072 * a list of entities 073 */ 074 public void addEntities(List<TimelineEntity> entities) { 075 this.entities.addAll(entities); 076 } 077 078 /** 079 * Set the entity list to the given list of entities 080 * 081 * @param entities 082 * a list of entities 083 */ 084 public void setEntities(List<TimelineEntity> entities) { 085 this.entities = entities; 086 } 087 088}