KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > impl > NonPersistentFormat


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: NonPersistentFormat.java,v 1.11 2006/10/30 21:14:32 bostic Exp $
7  */

8
9 package com.sleepycat.persist.impl;
10
11 import java.lang.reflect.Array JavaDoc;
12 import java.util.Map JavaDoc;
13
14 /**
15  * Format for a non-persistent class that is only used for declared field
16  * types and arrays. Currently used only for Object and interface types.
17  *
18  * @author Mark Hayes
19  */

20 class NonPersistentFormat extends Format {
21
22     private static final long serialVersionUID = -7488355830875148784L;
23
24     NonPersistentFormat(Class JavaDoc type) {
25         super(type);
26     }
27
28     @Override JavaDoc
29     void initialize(Catalog catalog) {
30     }
31
32     @Override JavaDoc
33     void collectRelatedFormats(Catalog catalog,
34                                Map JavaDoc<String JavaDoc,Format> newFormats) {
35     }
36
37     @Override JavaDoc
38     Object JavaDoc newArray(int len) {
39         return Array.newInstance(getType(), len);
40     }
41
42     @Override JavaDoc
43     public Object JavaDoc newInstance(EntityInput input, boolean rawAccess) {
44         throw new UnsupportedOperationException JavaDoc
45             ("Cannot instantiate non-persistent class: " + getClassName());
46     }
47
48     @Override JavaDoc
49     public Object JavaDoc readObject(Object JavaDoc o, EntityInput input, boolean rawAccess) {
50         throw new UnsupportedOperationException JavaDoc();
51     }
52
53     @Override JavaDoc
54     void writeObject(Object JavaDoc o, EntityOutput output, boolean rawAccess) {
55         throw new UnsupportedOperationException JavaDoc();
56     }
57
58     @Override JavaDoc
59     void skipContents(RecordInput input) {
60         throw new UnsupportedOperationException JavaDoc();
61     }
62
63     @Override JavaDoc
64     boolean evolve(Format newFormat, Evolver evolver) {
65         evolver.useOldFormat(this, newFormat);
66         return true;
67     }
68 }
69
Popular Tags