001: // You can redistribute this software and/or modify it under the terms of
002: // the Ozone Core License version 1 published by ozone-db.org.
003: //
004: // The original code and portions created by SMB are
005: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006: //
007: // $Id: ValueObjElement.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
008:
009: package org.ozoneDB.core.xml;
010:
011: import org.xml.sax.*;
012: import org.ozoneDB.OzoneProxy;
013:
014: /**
015: * This class saves all attributes of the valueObjElement.
016: *
017: * @version $Revision: 1.1 $
018: * @author <a href="http://www.softwarebuero.de">SMB</a>
019: */
020: public class ValueObjElement implements Consts {
021:
022: //
023: // member
024: //
025:
026: /**
027: * The type of the valueObj.
028: */
029: private String type;
030:
031: /**
032: * The id of the valueObj.
033: */
034: private String id;
035:
036: /**
037: */
038: private Object obj;
039:
040: //
041: // constructor
042: //
043:
044: /**
045: * The constructor creates a new instance of the obj with this className.
046: *
047: * @param atts (the attributes)
048: */
049: public ValueObjElement() {
050: }
051:
052: /**
053: * This constructor creates a proper ValueObjElement object,
054: * containing an OzoneProxy.
055: *
056: * @param proxy (an OzoneProxy)
057: */
058: public ValueObjElement(OzoneProxy proxy) {
059: this .obj = proxy;
060: this .type = proxy.getClass().getName();
061: }
062:
063: /**
064: * The constructor creates a new instance of the obj with this className.
065: *
066: * @param atts (the attributes)
067: */
068: public ValueObjElement(Attributes atts)
069: throws ClassNotFoundException, InstantiationException,
070: IllegalAccessException {
071: type = atts.getValue(ATTR_TYPE);
072: id = atts.getValue(ATTR_ID);
073:
074: Class objClass = Thread.currentThread().getContextClassLoader()
075: .loadClass(type);
076: obj = objClass.newInstance();
077: }
078:
079: //
080: // methods
081: //
082:
083: /**
084: */
085: public String getType() {
086: return type;
087: }
088:
089: /**
090: */
091: public String getId() {
092: return id;
093: }
094:
095: /**
096: */
097: public Object getObject() {
098: return obj;
099: }
100:
101: /**
102: */
103: public String toString() {
104: return ("ValueObjElement: " + type);
105: }
106: }
|