Java Code Examples for com.sun.tools.corba.se.idl.InterfaceEntry#isAbstract()

The following examples show how to use com.sun.tools.corba.se.idl.InterfaceEntry#isAbstract() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InterfaceGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  InterfaceEntry i = (InterfaceEntry)entry;
  if (i.isAbstract ())
    stream.println ("    return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
  else
    stream.println ("    return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
}
 
Example 2
Source File: InterfaceGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeSignatureHeading ()
{
  String className = i.name ();
  stream.print ("public interface " + className + " extends " + className + "Operations, ");
  boolean firstTime = true;
  boolean hasNonAbstractParent = false; // <d62310-klr>
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    if (firstTime)
      firstTime = false;
    else
      stream.print (", ");
    InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
    stream.print (Util.javaName (parent));
    if (! parent.isAbstract ()) // <d62310-klr>
      hasNonAbstractParent = true; // <d62310-klr>
  }
  // <d62310-klr> - begin
  // If this interface extends only abstract interfaces,
  // it should extend both org.omg.CORBA.Object and IDLEntity.
  if (!hasNonAbstractParent) {
    stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
  }
  else {
  // <d62310-klr> - end
      // extends IDLEntity if there's only one default parent - CORBA.Object
      if (i.derivedFrom ().size () == 1)
        stream.print (", org.omg.CORBA.portable.IDLEntity ");
  }
}
 
Example 3
Source File: InterfaceGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeSignatureHeading ()
{
  String className = i.name ();
  stream.print ("public interface " + className + " extends " + className + "Operations, ");
  boolean firstTime = true;
  boolean hasNonAbstractParent = false; // <d62310-klr>
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    if (firstTime)
      firstTime = false;
    else
      stream.print (", ");
    InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
    stream.print (Util.javaName (parent));
    if (! parent.isAbstract ()) // <d62310-klr>
      hasNonAbstractParent = true; // <d62310-klr>
  }
  // <d62310-klr> - begin
  // If this interface extends only abstract interfaces,
  // it should extend both org.omg.CORBA.Object and IDLEntity.
  if (!hasNonAbstractParent) {
    stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
  }
  else {
  // <d62310-klr> - end
      // extends IDLEntity if there's only one default parent - CORBA.Object
      if (i.derivedFrom ().size () == 1)
        stream.print (", org.omg.CORBA.portable.IDLEntity ");
  }
}
 
Example 4
Source File: InterfaceGen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeSignatureHeading ()
{
  String className = i.name ();
  stream.print ("public interface " + className + " extends " + className + "Operations, ");
  boolean firstTime = true;
  boolean hasNonAbstractParent = false; // <d62310-klr>
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    if (firstTime)
      firstTime = false;
    else
      stream.print (", ");
    InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
    stream.print (Util.javaName (parent));
    if (! parent.isAbstract ()) // <d62310-klr>
      hasNonAbstractParent = true; // <d62310-klr>
  }
  // <d62310-klr> - begin
  // If this interface extends only abstract interfaces,
  // it should extend both org.omg.CORBA.Object and IDLEntity.
  if (!hasNonAbstractParent) {
    stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
  }
  else {
  // <d62310-klr> - end
      // extends IDLEntity if there's only one default parent - CORBA.Object
      if (i.derivedFrom ().size () == 1)
        stream.print (", org.omg.CORBA.portable.IDLEntity ");
  }
}
 
Example 5
Source File: InterfaceGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeOperationsHeading ()
{
  stream.print ("public interface " + i.name ());
  if ( !i.isAbstract ())
    stream.print ("Operations ");
  else {
      // <d60929> - base abstract interfaces extend AbstractBase
      // changed to IDLEntity by SCN per latest spec...
      if (i.derivedFrom ().size () == 0)
        stream.print (" extends org.omg.CORBA.portable.IDLEntity");
  }

  boolean firstTime = true;
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
    String parentName = Util.javaName (parent);

    // ignore the default parent - CORBA.Object
    if (parentName.equals ("org.omg.CORBA.Object"))
        continue;

    if (firstTime)
    {
      firstTime = false;
      stream.print (" extends ");
    }
    else
      stream.print (", ");

    // Don't append suffix Operations to the parents of abstract interface
    // or to the abstract parents of regular interface
    if (parent.isAbstract () || i.isAbstract ())
      stream.print (parentName);
    else
      stream.print (parentName + "Operations");
  }
}
 
Example 6
Source File: InterfaceGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeSignatureHeading ()
{
  String className = i.name ();
  stream.print ("public interface " + className + " extends " + className + "Operations, ");
  boolean firstTime = true;
  boolean hasNonAbstractParent = false; // <d62310-klr>
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    if (firstTime)
      firstTime = false;
    else
      stream.print (", ");
    InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
    stream.print (Util.javaName (parent));
    if (! parent.isAbstract ()) // <d62310-klr>
      hasNonAbstractParent = true; // <d62310-klr>
  }
  // <d62310-klr> - begin
  // If this interface extends only abstract interfaces,
  // it should extend both org.omg.CORBA.Object and IDLEntity.
  if (!hasNonAbstractParent) {
    stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
  }
  else {
  // <d62310-klr> - end
      // extends IDLEntity if there's only one default parent - CORBA.Object
      if (i.derivedFrom ().size () == 1)
        stream.print (", org.omg.CORBA.portable.IDLEntity ");
  }
}
 
Example 7
Source File: InterfaceGen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeOperationsHeading ()
{
  stream.print ("public interface " + i.name ());
  if ( !i.isAbstract ())
    stream.print ("Operations ");
  else {
      // <d60929> - base abstract interfaces extend AbstractBase
      // changed to IDLEntity by SCN per latest spec...
      if (i.derivedFrom ().size () == 0)
        stream.print (" extends org.omg.CORBA.portable.IDLEntity");
  }

  boolean firstTime = true;
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
    String parentName = Util.javaName (parent);

    // ignore the default parent - CORBA.Object
    if (parentName.equals ("org.omg.CORBA.Object"))
        continue;

    if (firstTime)
    {
      firstTime = false;
      stream.print (" extends ");
    }
    else
      stream.print (", ");

    // Don't append suffix Operations to the parents of abstract interface
    // or to the abstract parents of regular interface
    if (parent.isAbstract () || i.isAbstract ())
      stream.print (parentName);
    else
      stream.print (parentName + "Operations");
  }
}
 
Example 8
Source File: InterfaceGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeSignatureHeading ()
{
  String className = i.name ();
  stream.print ("public interface " + className + " extends " + className + "Operations, ");
  boolean firstTime = true;
  boolean hasNonAbstractParent = false; // <d62310-klr>
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    if (firstTime)
      firstTime = false;
    else
      stream.print (", ");
    InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
    stream.print (Util.javaName (parent));
    if (! parent.isAbstract ()) // <d62310-klr>
      hasNonAbstractParent = true; // <d62310-klr>
  }
  // <d62310-klr> - begin
  // If this interface extends only abstract interfaces,
  // it should extend both org.omg.CORBA.Object and IDLEntity.
  if (!hasNonAbstractParent) {
    stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
  }
  else {
  // <d62310-klr> - end
      // extends IDLEntity if there's only one default parent - CORBA.Object
      if (i.derivedFrom ().size () == 1)
        stream.print (", org.omg.CORBA.portable.IDLEntity ");
  }
}
 
Example 9
Source File: InterfaceGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeOperationsHeading ()
{
  stream.print ("public interface " + i.name ());
  if ( !i.isAbstract ())
    stream.print ("Operations ");
  else {
      // <d60929> - base abstract interfaces extend AbstractBase
      // changed to IDLEntity by SCN per latest spec...
      if (i.derivedFrom ().size () == 0)
        stream.print (" extends org.omg.CORBA.portable.IDLEntity");
  }

  boolean firstTime = true;
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
    String parentName = Util.javaName (parent);

    // ignore the default parent - CORBA.Object
    if (parentName.equals ("org.omg.CORBA.Object"))
        continue;

    if (firstTime)
    {
      firstTime = false;
      stream.print (" extends ");
    }
    else
      stream.print (", ");

    // Don't append suffix Operations to the parents of abstract interface
    // or to the abstract parents of regular interface
    if (parent.isAbstract () || i.isAbstract ())
      stream.print (parentName);
    else
      stream.print (parentName + "Operations");
  }
}
 
Example 10
Source File: InterfaceGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void writeOperationsHeading ()
{
  stream.print ("public interface " + i.name ());
  if ( !i.isAbstract ())
    stream.print ("Operations ");
  else {
      // <d60929> - base abstract interfaces extend AbstractBase
      // changed to IDLEntity by SCN per latest spec...
      if (i.derivedFrom ().size () == 0)
        stream.print (" extends org.omg.CORBA.portable.IDLEntity");
  }

  boolean firstTime = true;
  for (int k = 0; k < i.derivedFrom ().size (); ++k)
  {
    InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
    String parentName = Util.javaName (parent);

    // ignore the default parent - CORBA.Object
    if (parentName.equals ("org.omg.CORBA.Object"))
        continue;

    if (firstTime)
    {
      firstTime = false;
      stream.print (" extends ");
    }
    else
      stream.print (", ");

    // Don't append suffix Operations to the parents of abstract interface
    // or to the abstract parents of regular interface
    if (parent.isAbstract () || i.isAbstract ())
      stream.print (parentName);
    else
      stream.print (parentName + "Operations");
  }
}
 
Example 11
Source File: InterfaceGen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  InterfaceEntry i = (InterfaceEntry)entry;
  if (i.isAbstract ())
    stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
  else
    stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
  return index;
}
 
Example 12
Source File: InterfaceGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  InterfaceEntry i = (InterfaceEntry)entry;
  if (i.isAbstract ())
    stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
  else
    stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
  return index;
}
 
Example 13
Source File: InterfaceGen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  InterfaceEntry i = (InterfaceEntry)entry;
  if (i.isAbstract ())
    stream.println ("    return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
  else
    stream.println ("    return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
}
 
Example 14
Source File: Helper.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the narrow() method for a remotable object.
 **/
protected void writeRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteNarrowForLocal (false);
      return;
  }

  // narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else if (!obj._is_a (id ()))");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 15
Source File: Helper.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the unchecked narrow() method for a remotable object.
 **/
protected void writeUncheckedRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // unchecked narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteUncheckedNarrowForLocal (false);
      return;
  }

  // unchecked narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteUncheckedNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteUncheckedNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 16
Source File: Helper.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the narrow() method for a remotable object.
 **/
protected void writeRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteNarrowForLocal (false);
      return;
  }

  // narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else if (!obj._is_a (id ()))");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 17
Source File: Helper.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the unchecked narrow() method for a remotable object.
 **/
protected void writeUncheckedRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // unchecked narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteUncheckedNarrowForLocal (false);
      return;
  }

  // unchecked narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteUncheckedNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteUncheckedNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 18
Source File: Helper.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the narrow() method for a remotable object.
 **/
protected void writeRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteNarrowForLocal (false);
      return;
  }

  // narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else if (!obj._is_a (id ()))");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 19
Source File: Helper.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the unchecked narrow() method for a remotable object.
 **/
protected void writeUncheckedRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // unchecked narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteUncheckedNarrowForLocal (false);
      return;
  }

  // unchecked narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteUncheckedNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteUncheckedNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}
 
Example 20
Source File: Helper.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Write the narrow() method for a remotable object.
 **/
protected void writeRemoteNarrow ()
{
  InterfaceEntry ie = (InterfaceEntry) entry;

  // narrow for LocalObject interface
  if (ie.isLocal ()) {
      writeRemoteNarrowForLocal (false);
      return;
  }

  // narrow for Abstract interface
  if (ie.isAbstract ()) {
      writeRemoteNarrowForAbstract (false);
      return;
  } else {
      // Determine if the non-abstract interface has any abstract parents
      for (int i = 0; i < ie.derivedFrom ().size (); i++) {
          SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
          if (((InterfaceEntry) parent).isAbstract ()) {
              writeRemoteNarrowForAbstract (true);
              break;
          }
      }
  }

  stream.println ("  public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
  stream.println ("  {");
  stream.println ("    if (obj == null)");
  stream.println ("      return null;");
  stream.println ("    else if (obj instanceof " + helperType + ')');
  stream.println ("      return (" + helperType + ")obj;");
  stream.println ("    else if (!obj._is_a (id ()))");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    else");
  stream.println ("    {");
  stream.println ("      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
  String stubNameofEntry = stubName ((InterfaceEntry)entry);
  stream.println ("      " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
  stream.println ("      stub._set_delegate(delegate);");
  stream.println ("      return stub;");
  stream.println ("    }");
  stream.println ("  }");
}