01: package org.apache.ojb.broker.metadata.fieldaccess;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.io.Serializable;
19:
20: import org.apache.ojb.broker.metadata.MetadataException;
21:
22: /**
23: * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
24: * @version $Id: PersistentField.java,v 1.8.2.2 2005/12/21 22:26:41 tomdz Exp $
25: */
26: public interface PersistentField extends Serializable {
27: public Class getDeclaringClass();
28:
29: public String getName();
30:
31: public Class getType();
32:
33: /**
34: * Sets the field represented by this PersistentField object on the specified object argument to the specified new value.
35: * The new value is automatically unwrapped if the underlying field has a primitive type.
36: * This implementation invokes set() on its underlying Field object if the argument <b>is not null</b>.
37: * OBS IllegalArgumentExceptions are wrapped as PersistenceBrokerExceptions.
38: *
39: * @param obj The target object (no proxy objects allowed).
40: * @param value The value to set.
41: * @throws MetadataException if there is an error setting this field value on obj
42: * @see java.lang.reflect.Field
43: */
44: public void set(Object obj, Object value) throws MetadataException;
45:
46: /**
47: * Returns the value of the field represented by this PersistentField, on the specified object.
48: * This implementation invokes get() on its underlying Field object.
49: *
50: * @param anObject - The object instance (proxy objects are not allowed here) which we are
51: * trying to get the field value from.
52: * @throws MetadataException if there is an error getting this field value from obj
53: * @see java.lang.reflect.Field
54: */
55: public Object get(Object anObject) throws MetadataException;
56:
57: public boolean usesAccessorsAndMutators();
58: }
|