KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > catalog > types > MethodAliasInfo


1 /*
2
3    Derby - Class org.apache.derby.catalog.types.MethodAliasInfo
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.catalog.types;
23
24 import org.apache.derby.iapi.services.io.Formatable;
25 import org.apache.derby.iapi.services.io.StoredFormatIds;
26 import org.apache.derby.iapi.reference.SQLState;
27 import org.apache.derby.catalog.AliasInfo;
28 import java.io.IOException JavaDoc;
29 import java.io.ObjectInput JavaDoc;
30 import java.io.ObjectOutput JavaDoc;
31
32 /**
33  * Describe a method alias.
34  *
35  * @see AliasInfo
36  */

37 public class MethodAliasInfo
38 implements AliasInfo, Formatable
39 {
40     /********************************************************
41     **
42     ** This class implements Formatable. That means that it
43     ** can write itself to and from a formatted stream. If
44     ** you add more fields to this class, make sure that you
45     ** also write/read them with the writeExternal()/readExternal()
46     ** methods.
47     **
48     ** If, inbetween releases, you add more fields to this class,
49     ** then you should bump the version number emitted by the getTypeFormatId()
50     ** method.
51     **
52     ********************************************************/

53
54     private String JavaDoc methodName;
55
56     /**
57      * Public niladic constructor. Needed for Formatable interface to work.
58      */

59     public MethodAliasInfo() {}
60
61     /**
62      * Create a MethodAliasInfo
63      *
64      * @param methodName The name of the method for the alias.
65      */

66     public MethodAliasInfo(String JavaDoc methodName)
67     {
68         this.methodName = methodName;
69     }
70
71     // Formatable methods
72

73     /**
74      * Read this object from a stream of stored objects.
75      *
76      * @param in read this.
77      *
78      * @exception IOException thrown on error
79      * @exception ClassNotFoundException thrown on error
80      */

81     public void readExternal( ObjectInput JavaDoc in )
82          throws IOException JavaDoc, ClassNotFoundException JavaDoc
83     {
84         methodName = (String JavaDoc)in.readObject();
85     }
86
87     /**
88      * Write this object to a stream of stored objects.
89      *
90      * @param out write bytes here.
91      *
92      * @exception IOException thrown on error
93      */

94     public void writeExternal( ObjectOutput JavaDoc out )
95          throws IOException JavaDoc
96     {
97         out.writeObject( methodName );
98     }
99  
100     /**
101      * Get the formatID which corresponds to this class.
102      *
103      * @return the formatID of this class
104      */

105     public int getTypeFormatId() { return StoredFormatIds.METHOD_ALIAS_INFO_V01_ID; }
106
107     //
108
// AliasInfo methods
109
//
110
/**
111       @see org.apache.derby.catalog.AliasInfo#getMethodName
112       */

113     public String JavaDoc getMethodName()
114     {
115         return methodName;
116     }
117
118     /**
119       @see java.lang.Object#toString
120       */

121     public String JavaDoc toString()
122     {
123         return methodName;
124     }
125 }
126
Popular Tags