Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / catalog / types / UserDefinedTypeIdImpl.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/catalog/types/UserDefinedTypeIdImpl.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/catalog/types/UserDefinedTypeIdImpl.java
new file mode 100644 (file)
index 0000000..77b39ac
--- /dev/null
@@ -0,0 +1,124 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.catalog.types.UserDefinedTypeIdImpl\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.catalog.types;\r
+\r
+import org.apache.derby.iapi.services.io.StoredFormatIds;\r
+\r
+import java.sql.Types;\r
+import java.io.ObjectOutput;\r
+import java.io.ObjectInput;\r
+import java.io.IOException;\r
+\r
+public class UserDefinedTypeIdImpl extends BaseTypeIdImpl\r
+{\r
+       /********************************************************\r
+       **\r
+       **      This class implements Formatable. That means that it\r
+       **      can write itself to and from a formatted stream. If\r
+       **      you add more fields to this class, make sure that you\r
+       **      also write/read them with the writeExternal()/readExternal()\r
+       **      methods.\r
+       **\r
+       **      If, inbetween releases, you add more fields to this class,\r
+       **      then you should bump the version number emitted by the getTypeFormatId()\r
+       **      method.\r
+       **\r
+       ********************************************************/\r
+\r
+       protected String className;\r
+\r
+       /**\r
+        * Public niladic constructor. Needed for Formatable interface to work.\r
+        *\r
+        */\r
+       public  UserDefinedTypeIdImpl() { super(); }\r
+\r
+       /**\r
+        * Constructor for a UserDefinedTypeIdImpl. The SQLTypeName of a UserDefinedType\r
+        * is assumed to be its className.\r
+        *\r
+        * @param className     The SQL name of the type\r
+        */\r
+\r
+       public UserDefinedTypeIdImpl(String className)\r
+       {\r
+               super(className);\r
+               this.className = className;\r
+               JDBCTypeId = java.sql.Types.JAVA_OBJECT;\r
+       }\r
+\r
+\r
+       /** Return the java class name for this type */\r
+       public String   getClassName()\r
+       {\r
+               return className;\r
+       }\r
+\r
+       /** Does this type id represent a user type? */\r
+       public boolean userType()\r
+       {\r
+               return true;\r
+       }\r
+       // Formatable interface.\r
+\r
+       /**\r
+        * Read this object from a stream of stored objects.\r
+        *\r
+        * @param in read this.\r
+        *\r
+        * @exception IOException                                       thrown on error\r
+        * @exception ClassNotFoundException            thrown on error\r
+        */\r
+       public void readExternal( ObjectInput in )\r
+                throws IOException, ClassNotFoundException\r
+       {\r
+               super.readExternal( in );\r
+               className = in.readUTF();\r
+               JDBCTypeId = java.sql.Types.JAVA_OBJECT;\r
+       }\r
+\r
+       /**\r
+        * Write this object to a stream of stored objects.\r
+        *\r
+        * @param out write bytes here.\r
+        *\r
+        * @exception IOException               thrown on error\r
+        */\r
+       public void writeExternal( ObjectOutput out )\r
+                throws IOException\r
+       {\r
+               super.writeExternal( out );\r
+               out.writeUTF( className );\r
+       }\r
+       /**\r
+        * Get the formatID which corresponds to this class.\r
+        *\r
+        *      @return the formatID of this class\r
+        */\r
+       public  int     getTypeFormatId()       { return StoredFormatIds.USERDEFINED_TYPE_ID_IMPL_V3; }\r
+\r
+       /**\r
+        * Get the format id for the wrapper type id that corresponds to\r
+        * this type id.\r
+        */\r
+       public int wrapperTypeFormatId() { return StoredFormatIds.USERDEFINED_TYPE_ID_V3; }\r
+}\r