src/share/classes/sun/rmi/rmic/iiop/InterfaceType.java

Wed, 28 Mar 2012 02:50:50 -0700

author
mbankal
date
Wed, 28 Mar 2012 02:50:50 -0700
changeset 371
e324dfb90c9e
parent 158
91006f157c46
child 748
6845b95cba6b
permissions
-rw-r--r--

7079902: Refine CORBA data models
Reviewed-by: coffeys

     1 /*
     2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 /*
    27  * Licensed Materials - Property of IBM
    28  * RMI-IIOP v1.0
    29  * Copyright IBM Corp. 1998 1999  All Rights Reserved
    30  *
    31  */
    33 package sun.rmi.rmic.iiop;
    35 import java.io.IOException;
    36 import sun.tools.java.CompilerError;
    37 import sun.tools.java.ClassDefinition;
    38 import sun.rmi.rmic.IndentingWriter;
    40 /**
    41  * InterfaceType is an abstract base representing any non-special
    42  * interface type.
    43  *
    44  * @author      Bryan Atsatt
    45  */
    46 public abstract class InterfaceType extends CompoundType {
    48     //_____________________________________________________________________
    49     // Public Interfaces
    50     //_____________________________________________________________________
    52     /**
    53      * Print this type.
    54      * @param writer The stream to print to.
    55      * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
    56      * @param useIDLNames If true, print IDL names; otherwise, print java names.
    57      * @param globalIDLNames If true and useIDLNames true, prepends "::".
    58      */
    59     public void print ( IndentingWriter writer,
    60                         boolean useQualifiedNames,
    61                         boolean useIDLNames,
    62                         boolean globalIDLNames) throws IOException {
    64         if (isInner()) {
    65             writer.p("// " + getTypeDescription() + " (INNER)");
    66         } else {
    67             writer.p("// " + getTypeDescription() + "");
    68         }
    69         writer.pln(" (" + getRepositoryID() + ")\n");
    70         printPackageOpen(writer,useIDLNames);
    72         if (!useIDLNames) {
    73             writer.p("public ");
    74         }
    76         writer.p("interface " + getTypeName(false,useIDLNames,false));
    77         printImplements(writer,"",useQualifiedNames,useIDLNames,globalIDLNames);
    78         writer.plnI(" {");
    79         printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    80         writer.pln();
    81         printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    82         writer.pln();
    84         if (useIDLNames) {
    85             writer.pOln("};");
    86         } else {
    87             writer.pOln("}");
    88         }
    89         printPackageClose(writer,useIDLNames);
    90     }
    92     //_____________________________________________________________________
    93     // Subclass/Internal Interfaces
    94     //_____________________________________________________________________
    96     /**
    97      * Create a InterfaceType instance for the given class. NOTE: This constructor
    98      * is ONLY for SpecialInterfaceType.
    99      */
   100     protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) {
   101         super(stack,typeCode,classDef); // Call special parent constructor.
   103         if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
   104             throw new CompilerError("Not an interface");
   105         }
   106     }
   108     /**
   109      * Create a InterfaceType instance for the given class.  The resulting
   110      * object is not yet completely initialized. Subclasses must call
   111      * initialize(directInterfaces,directInterfaces,directConstants);
   112      */
   113     protected InterfaceType(ContextStack stack,
   114                             ClassDefinition classDef,
   115                             int typeCode) {
   116         super(stack,classDef,typeCode);
   118         if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
   119             throw new CompilerError("Not an interface");
   120         }
   121     }
   122 }

mercurial