KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > xml > ValueObjElement


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: ValueObjElement.java,v 1.3 2002/09/18 06:54:17 per_nyfelt Exp $
8

9 package org.ozoneDB.core.xml;
10
11 import org.xml.sax.*;
12 import org.ozoneDB.OzoneProxy;
13
14 /**
15  * This class saves all attributes of the valueObjElement.
16  *
17  * @version $Revision: 1.3 $
18  * @author <a HREF="http://www.softwarebuero.de">SMB</a>
19  */

20 public class ValueObjElement implements Consts {
21
22     //
23
// member
24
//
25

26     /**
27      * The type of the valueObj.
28      */

29     private String JavaDoc type;
30
31     /**
32      * The id of the valueObj.
33      */

34     private String JavaDoc id;
35
36     /**
37      */

38     private Object JavaDoc obj;
39
40     //
41
// constructor
42
//
43

44     /**
45      * The constructor creates a new instance of the obj with this className.
46      */

47     public ValueObjElement () {
48     }
49
50     /**
51      * This constructor creates a proper ValueObjElement object,
52      * containing an OzoneProxy.
53      *
54      * @param proxy (an OzoneProxy)
55      */

56     public ValueObjElement (OzoneProxy proxy) {
57        this.obj = proxy;
58        this.type = proxy.getClass().getName();
59     }
60
61     /**
62      * The constructor creates a new instance of the obj with this className.
63      *
64      * @param atts (the attributes)
65      */

66     public ValueObjElement (Attributes atts)
67     throws ClassNotFoundException JavaDoc, InstantiationException JavaDoc, IllegalAccessException JavaDoc {
68         type = atts.getValue(ATTR_TYPE);
69         id = atts.getValue(ATTR_ID);
70
71         Class JavaDoc objClass = Thread.currentThread().getContextClassLoader().loadClass(type);
72         obj = objClass.newInstance();
73     }
74
75     //
76
// methods
77
//
78

79     /**
80      */

81     public String JavaDoc getType() {
82         return type;
83     }
84
85     /**
86      */

87     public String JavaDoc getId() {
88         return id;
89     }
90
91     /**
92      */

93     public Object JavaDoc getObject() {
94         return obj;
95     }
96
97     /**
98      */

99     public String JavaDoc toString() {
100         return ("ValueObjElement: " + type);
101     }
102 }
103
104
Popular Tags