01: /*
02: *
03: * JMoney - A Personal Finance Manager
04: * Copyright (c) 2002 Johann Gyger <johann.gyger@switzerland.org>
05: * Copyright (c) 2004 Nigel Westbury <westbury@users.sourceforge.net>
06: *
07: *
08: * This program is free software; you can redistribute it and/or modify
09: * it under the terms of the GNU General Public License as published by
10: * the Free Software Foundation; either version 2 of the License, or
11: * (at your option) any later version.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with this program; if not, write to the Free Software
20: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package net.sf.jmoney.model2;
25:
26: /**
27: *
28: * @author Nigel
29: *
30: * To add fields and methods to an Account object, one should
31: * derive a class on AccountExtension. This mechanism
32: * allows multiple extensions to an Account object to be added
33: * and maintained at runtime.
34: *
35: */
36: public abstract class AccountExtension extends ExtensionObject {
37:
38: public AccountExtension(ExtendableObject extendedObject) {
39: super (extendedObject);
40: }
41:
42: /*
43: * All extensions to Account objects implement the Account interface. This is for convenience
44: * so the comsumer can get a single object that supports both the base Entry
45: * methods and the extension methods. All Account interface methods are passed
46: * on to the base Account object.
47: */
48:
49: /**
50: * @return the name of the category.
51: */
52: public String getName() {
53: return getBaseObject().getName();
54: }
55:
56: /**
57: * @return the full qualified name of the category.
58: */
59: public String getFullAccountName() {
60: return getBaseObject().getFullAccountName();
61: }
62:
63: public Account getParent() {
64: return getBaseObject().getParent();
65: }
66:
67: public ObjectCollection getSubAccountCollection() {
68: return getBaseObject().getSubAccountCollection();
69: }
70:
71: public Account getBaseObject() {
72: return (Account) baseObject;
73: }
74: }
|