001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.enhance;
020:
021: /**
022: * Interface for dynamically generated classes. Certain getters/setters
023: * may either return null or throw an exception depending on the
024: * {@link DynamicStorageGenerator}'s field policy.
025: *
026: * @author Steve Kim
027: * @nojavadoc
028: * @since 0.3.2.0
029: */
030: public interface DynamicStorage {
031:
032: /**
033: * Return the number of fields, regardless of type
034: */
035: public int getFieldCount();
036:
037: /**
038: * Return the number of object fields
039: */
040: public int getObjectCount();
041:
042: /**
043: * Factory method for getting new instances of the same definition.
044: */
045: public DynamicStorage newInstance();
046:
047: /**
048: * Get the boolean at the given index.
049: */
050: public boolean getBoolean(int field);
051:
052: /**
053: * Set the boolean at the given index.
054: */
055: public void setBoolean(int field, boolean val);
056:
057: /**
058: * Get the byte at the given index.
059: */
060: public byte getByte(int field);
061:
062: /**
063: * Set the byte at the given index.
064: */
065: public void setByte(int field, byte val);
066:
067: /**
068: * Get the char at the given index.
069: */
070: public char getChar(int field);
071:
072: /**
073: * Set the char at the given index.
074: */
075: public void setChar(int field, char val);
076:
077: /**
078: * Get the double at the given index.
079: */
080: public double getDouble(int field);
081:
082: /**
083: * Set the double at the given index.
084: */
085: public void setDouble(int field, double val);
086:
087: /**
088: * Get the float at the given index.
089: */
090: public float getFloat(int field);
091:
092: /**
093: * Set the float at the given index.
094: */
095: public void setFloat(int field, float val);
096:
097: /**
098: * Get the int at the given index.
099: */
100: public int getInt(int field);
101:
102: /**
103: * Set the int at the given index.
104: */
105: public void setInt(int field, int val);
106:
107: /**
108: * Get the long at the given index.
109: */
110: public long getLong(int field);
111:
112: /**
113: * Set the long at the given index.
114: */
115: public void setLong(int field, long val);
116:
117: /**
118: * Get the short at the given index.
119: */
120: public short getShort(int field);
121:
122: /**
123: * Set the short at the given index.
124: */
125: public void setShort(int field, short val);
126:
127: /**
128: * Get the object at the given index.
129: */
130: public Object getObject(int field);
131:
132: /**
133: * Set the object at the given index.
134: */
135: public void setObject(int field, Object val);
136:
137: /**
138: * Ensure object capacity
139: */
140: public void initialize();
141: }
|