001: /*****************************************************************************
002: * Java Plug-in Framework (JPF)
003: * Copyright (C) 2006-2007 Dmitry Olshansky
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *****************************************************************************/package org.java.plugin.tools.mocks;
019:
020: import java.util.Collection;
021: import java.util.Collections;
022: import java.util.LinkedList;
023:
024: import org.java.plugin.registry.Documentation;
025: import org.java.plugin.registry.Identity;
026:
027: /**
028: * @version $Id$
029: * @param <T> documentation owner element type
030: */
031: public class MockDocumentation<T extends Identity> implements
032: Documentation<T> {
033: private String caption;
034: private T declaringIdentity;
035: private String text;
036: private LinkedList<Reference<T>> references = new LinkedList<Reference<T>>();
037:
038: /**
039: * @see org.java.plugin.registry.Documentation#getCaption()
040: */
041: public String getCaption() {
042: return caption;
043: }
044:
045: /**
046: * @param value the caption to set
047: * @return this instance
048: */
049: public MockDocumentation<T> setCaption(final String value) {
050: caption = value;
051: return this ;
052: }
053:
054: /**
055: * @see org.java.plugin.registry.Documentation#getDeclaringIdentity()
056: */
057: public T getDeclaringIdentity() {
058: return declaringIdentity;
059: }
060:
061: /**
062: * @param value the declaring identity to set
063: * @return this instance
064: */
065: public MockDocumentation<T> setDeclaringIdentity(final T value) {
066: declaringIdentity = value;
067: return this ;
068: }
069:
070: /**
071: * @see org.java.plugin.registry.Documentation#getReferences()
072: */
073: public Collection<Reference<T>> getReferences() {
074: return Collections.unmodifiableCollection(references);
075: }
076:
077: /**
078: * @param reference reference to add
079: * @return this instance
080: */
081: public MockDocumentation<T> addReference(
082: final Reference<T> reference) {
083: references.add(reference);
084: return this ;
085: }
086:
087: /**
088: * @see org.java.plugin.registry.Documentation#getText()
089: */
090: public String getText() {
091: return text;
092: }
093:
094: /**
095: * @param value the text to set
096: * @return this instance
097: */
098: public MockDocumentation<T> setText(final String value) {
099: text = value;
100: return this;
101: }
102: }
|