Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PersistentField |
|
| 1.0;1 |
1 | package org.apache.ojb.broker.metadata.fieldaccess; | |
2 | ||
3 | /* Copyright 2002-2005 The Apache Software Foundation | |
4 | * | |
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * 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.1 2007-08-24 22:17:35 ewestfal Exp $ | |
25 | */ | |
26 | public interface PersistentField extends Serializable | |
27 | { | |
28 | public Class getDeclaringClass(); | |
29 | public String getName(); | |
30 | public Class getType(); | |
31 | ||
32 | /** | |
33 | * Sets the field represented by this PersistentField object on the specified object argument to the specified new value. | |
34 | * The new value is automatically unwrapped if the underlying field has a primitive type. | |
35 | * This implementation invokes set() on its underlying Field object if the argument <b>is not null</b>. | |
36 | * OBS IllegalArgumentExceptions are wrapped as PersistenceBrokerExceptions. | |
37 | * | |
38 | * @param obj The target object (no proxy objects allowed). | |
39 | * @param value The value to set. | |
40 | * @throws MetadataException if there is an error setting this field value on obj | |
41 | * @see java.lang.reflect.Field | |
42 | */ | |
43 | public void set(Object obj, Object value) throws MetadataException; | |
44 | ||
45 | /** | |
46 | * Returns the value of the field represented by this PersistentField, on the specified object. | |
47 | * This implementation invokes get() on its underlying Field object. | |
48 | * | |
49 | * @param anObject - The object instance (proxy objects are not allowed here) which we are | |
50 | * trying to get the field value from. | |
51 | * @throws MetadataException if there is an error getting this field value from obj | |
52 | * @see java.lang.reflect.Field | |
53 | */ | |
54 | public Object get(Object anObject) throws MetadataException; | |
55 | ||
56 | public boolean usesAccessorsAndMutators(); | |
57 | } |