KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > runtime > bean > ImplPersistenceDelegate


1 package org.apache.beehive.controls.runtime.bean;
2 /*
3  * Copyright 2004 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  * $Header:$
18  */

19
20 import java.beans.BeanInfo JavaDoc;
21 import java.beans.DefaultPersistenceDelegate JavaDoc;
22 import java.beans.Encoder JavaDoc;
23 import java.beans.Expression JavaDoc;
24 import java.beans.IntrospectionException JavaDoc;
25 import java.beans.Introspector JavaDoc;
26 import java.beans.PersistenceDelegate JavaDoc;
27 import java.beans.PropertyDescriptor JavaDoc;
28 import java.beans.Statement JavaDoc;
29 import java.beans.XMLEncoder JavaDoc;
30 import java.util.Set JavaDoc;
31
32 import org.apache.beehive.controls.api.ControlException;
33
34 /**
35  * The ImplPersistenceDelegate class supports the XML persistance of Control Implementation
36  * instances by implementing the <code>java.beans.PersistenceDelegate</b> API, and overriding
37  * the default persistance algorithm based upon the runtime structure for Controls.
38  * <p>
39  */

40 public class ImplPersistenceDelegate extends DefaultPersistenceDelegate JavaDoc
41 {
42     /**
43      * PersistenceDelegate.instantiate()
44      */

45     protected Expression JavaDoc instantiate(Object JavaDoc oldInstance, Encoder JavaDoc out)
46     {
47         //
48
// An implementation instance is actually constructed at decode time by calling
49
// ControlBean.ensureControl on the parent bean. This will create a new impl
50
// instance and run the impl initializer on it.
51
//
52
return new Expression JavaDoc(((XMLEncoder JavaDoc)out).getOwner(), "ensureControl", null);
53     }
54
55     /**
56      * PersistenceDelegate.initialize()
57      */

58     protected void initialize(Class JavaDoc<?> type, Object JavaDoc oldInstance, Object JavaDoc newInstance, Encoder JavaDoc out)
59     {
60         super.initialize(type, oldInstance, newInstance, out);
61     }
62
63     /**
64      * PersistenceDelegate.writeObject()
65      */

66     public void writeObject(Object JavaDoc oldInstance, Encoder JavaDoc out)
67     {
68         super.writeObject(oldInstance, out);
69     }
70 }
71
Popular Tags