001: /*
002: *
003: * JMoney - A Personal Finance Manager
004: * Copyright (c) 2002 Johann Gyger <johann.gyger@switzerland.org>
005: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
006: *
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License as published by
010: * the Free Software Foundation; either version 2 of the License, or
011: * (at your option) any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: package net.sf.jmoney.model2;
025:
026: import java.util.Date;
027:
028: /**
029: *
030: * @author Nigel
031: *
032: * To add fields and methods to an Entry object, one should
033: * derive a class on EntryExtension. This mechanism
034: * allows multiple extensions to an Entry object to be added
035: * and maintained at runtime.
036: *
037: */
038: public abstract class EntryExtension extends ExtensionObject {
039:
040: public EntryExtension(ExtendableObject extendedObject) {
041: super (extendedObject);
042: }
043:
044: /*
045: * All extensions implement the Entry interface. This is for convenience
046: * so the comsumer can get a single object that supports both the base Entry
047: * methods and the extension methods. All Entry interface methods are passed
048: * on to the base Entry object.
049: */
050:
051: /**
052: * Returns the category.
053: */
054: public Account getAccount() {
055: return getBaseObject().getAccount();
056: }
057:
058: /**
059: * Returns the amount.
060: */
061: public long getAmount() {
062: return getBaseObject().getAmount();
063: }
064:
065: /**
066: * Sets the category.
067: */
068: public void setAccount(Account account) {
069: getBaseObject().setAccount(account);
070: }
071:
072: /**
073: * Sets the amount.
074: */
075: public void setAmount(long anAmount) {
076: getBaseObject().setAmount(anAmount);
077: }
078:
079: public Transaction getTransaction() {
080: return getBaseObject().getTransaction();
081: }
082:
083: /**
084: * Returns the creation.
085: */
086: public long getCreation() {
087: return getBaseObject().getCreation();
088: }
089:
090: /**
091: * Returns the check.
092: */
093: public String getCheck() {
094: return getBaseObject().getCheck();
095: }
096:
097: /**
098: * Returns the valuta.
099: */
100: public Date getValuta() {
101: return getBaseObject().getValuta();
102: }
103:
104: // TODO: should really be in a utility class.
105: public String getFullAccountName() {
106: return getBaseObject().getFullAccountName();
107: }
108:
109: /**
110: * Returns the memo.
111: */
112: public String getMemo() {
113: return getBaseObject().getMemo();
114: }
115:
116: /**
117: * Sets the creation.
118: */
119: public void setCreation(long creation) {
120: getBaseObject().setCreation(creation);
121: }
122:
123: /**
124: * Sets the check.
125: */
126: public void setCheck(String check) {
127: getBaseObject().setCheck(check);
128: }
129:
130: /**
131: * Sets the valuta.
132: */
133: public void setValuta(Date valuta) {
134: getBaseObject().setValuta(valuta);
135: }
136:
137: /**
138: * Sets the memo.
139: */
140: public void setMemo(String memo) {
141: getBaseObject().setMemo(memo);
142: }
143:
144: public Entry getBaseObject() {
145: return (Entry) baseObject;
146: }
147: }
|