View Javadoc

1   /* (c) Copyright 2003 Caleigo AB, All rights reserved. 
2    * 
3    * This library is free software; you can redistribute it and/or
4    * modify it under the terms of the GNU Lesser General Public
5    * License as published by the Free Software Foundation; either
6    * version 2.1 of the License, or (at your option) any later version.
7    * 
8    * This library is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   * Lesser General Public License for more details.
12   * 
13   * You should have received a copy of the GNU Lesser General Public
14   * License along with this library; if not, write to the Free Software
15   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   *  
17   */
18  package org.caleigo.core;
19  
20  /*** <Description of ContainedAbstractEntity>
21   *
22   * @author  Dennis Zikovic
23   * @version 1.00
24   * 
25   *//* 
26   *
27   * WHEN        WHO               WHY & WHAT
28   * ------------------------------------------------------------------------------
29   * 2001-07-9  Dennis Zikovic    Creation
30   */
31  public abstract class AbstractDataObjectEntity extends AbstractEntity 
32  {
33      // Data members ------------------------------------------------------------
34      private Object[] mFieldData;
35          
36      // Constructors ------------------------------------------------------------
37      
38      public AbstractDataObjectEntity() 
39      {
40      }
41      
42      public AbstractDataObjectEntity(Qualifier identityQualifier) 
43      {
44          super(identityQualifier);
45      }
46      
47      // Abstract methods --------------------------------------------------------
48      
49      /*** Return the entity objects IEntityDescriptor that defines it's type and 
50       * structure. Enables extended means of reflection for the entity. 
51       */
52      public abstract IEntityDescriptor getEntityDescriptor();
53      
54      // IEntity implementation --------------------------------------------------
55  
56      /*** Return the contained indexed data avoidinng any convertions 
57       * or formating. Note the package scope used to avoid missuse.
58       */
59      Object getRawData(int index)
60      {
61          if(mFieldData==null)
62              mFieldData = new Object[this.getEntityDescriptor().getDataFieldCount()];
63          return mFieldData[index];
64      }
65      
66      /*** Sets the indexed data avoiding any convertions or format changes.
67       * Does not update any flags or fire any event handled by the 
68       * AbstractEntityDescriptor. Note the package scope used to avoid missuse.
69       */
70      void setRawData(int index, Object data)
71      {
72          if(mFieldData==null)
73              mFieldData = new Object[this.getEntityDescriptor().getDataFieldCount()];
74          mFieldData[index] = data;
75      }
76  }