001
002/*
003 * Copyright (C) 2010 Archie L. Cobbs. All rights reserved.
004 *
005 * $Id$
006 */
007
008package org.dellroad.jibxbindings.pidf;
009
010import java.net.URI;
011import java.util.ArrayList;
012import java.util.List;
013
014/**
015 * Top level element in the Presence Information Data Format (PIDF).
016 */
017public class Presence implements Cloneable {
018
019    private URI entity;
020    private List<Component> components = new ArrayList<Component>();
021    private List<LangContent> notes = new ArrayList<LangContent>();
022
023    public URI getEntity() {
024        return this.entity;
025    }
026    public void setEntity(URI entity) {
027        this.entity = entity;
028    }
029
030    public List<Component> getComponents() {
031        return this.components;
032    }
033    public void setComponents(List<Component> components) {
034        this.components = components;
035    }
036
037    public List<LangContent> getNotes() {
038        return this.notes;
039    }
040    public void setNotes(List<LangContent> notes) {
041        this.notes = notes;
042    }
043
044// Cloneable
045
046    @Override
047    public Presence clone() {
048        final Presence clone;
049        try {
050            clone = (Presence)super.clone();
051        } catch (CloneNotSupportedException e) {
052            throw new RuntimeException(e);
053        }
054        if (this.components != null) {
055            clone.components = new ArrayList<>(this.components.size());
056            for (Component component : this.components)
057                clone.components.add(component.clone());
058        }
059        if (this.notes != null) {
060            clone.notes = new ArrayList<>(this.notes.size());
061            for (LangContent note : this.notes)
062                clone.notes.add(note.clone());
063        }
064        return clone;
065    }
066}
067