com.sun.tools.corba.se.idl.ValueBoxEntry Java Examples

The following examples show how to use com.sun.tools.corba.se.idl.ValueBoxEntry. 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: Helper24.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the heading, including package, imports, class statements,
 * and open curly.
 * <d62023> - don't implement ValueHelper, make non-boxed helpers abstract
 **/
protected void writeHeading ()
{
  Util.writePackage (stream, entry, Util.HelperFile);
  Util.writeProlog (stream, stream.name ());

  // Transfer comment to target <30jul1997daz>.
  if (entry.comment () != null)
    entry.comment ().generate ("", stream);

  if (entry instanceof ValueBoxEntry) {
      stream.print   ("public final class " + helperClass);
      stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper");
  }
  else
      stream.println ("abstract public class " + helperClass);
  stream.println ('{');
}
 
Example #2
Source File: ValueBoxGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #3
Source File: ValueBoxGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #4
Source File: Helper.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize variables unique to this generator.
 **/
protected void init ()
{
  helperClass = entry.name () + "Helper";
  if (entry instanceof ValueBoxEntry)
  {
    ValueBoxEntry v = (ValueBoxEntry) entry;
    TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
    SymtabEntry mType =  member.type ();

    if (mType instanceof PrimitiveEntry)
      helperType = Util.javaName (entry);
    else
      helperType = Util.javaName (mType);
  }
  else
    helperType = Util.javaName (entry);
}
 
Example #5
Source File: ValueBoxGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #6
Source File: ValueBoxGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #7
Source File: Helper24.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the heading, including package, imports, class statements,
 * and open curly.
 * <d62023> - don't implement ValueHelper, make non-boxed helpers abstract
 **/
protected void writeHeading ()
{
  Util.writePackage (stream, entry, Util.HelperFile);
  Util.writeProlog (stream, stream.name ());

  // Transfer comment to target <30jul1997daz>.
  if (entry.comment () != null)
    entry.comment ().generate ("", stream);

  if (entry instanceof ValueBoxEntry) {
      stream.print   ("public final class " + helperClass);
      stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper");
  }
  else
      stream.println ("abstract public class " + helperClass);
  stream.println ('{');
}
 
Example #8
Source File: Holder.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example #9
Source File: Holder.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example #10
Source File: Helper24.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the heading, including package, imports, class statements,
 * and open curly.
 * <d62023> - don't implement ValueHelper, make non-boxed helpers abstract
 **/
protected void writeHeading ()
{
  Util.writePackage (stream, entry, Util.HelperFile);
  Util.writeProlog (stream, stream.name ());

  // Transfer comment to target <30jul1997daz>.
  if (entry.comment () != null)
    entry.comment ().generate ("", stream);

  if (entry instanceof ValueBoxEntry) {
      stream.print   ("public final class " + helperClass);
      stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper");
  }
  else
      stream.println ("abstract public class " + helperClass);
  stream.println ('{');
}
 
Example #11
Source File: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #12
Source File: Holder.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example #13
Source File: ValueBoxGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #14
Source File: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #15
Source File: ValueBoxGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #16
Source File: Helper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize variables unique to this generator.
 **/
protected void init ()
{
  helperClass = entry.name () + "Helper";
  if (entry instanceof ValueBoxEntry)
  {
    ValueBoxEntry v = (ValueBoxEntry) entry;
    TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
    SymtabEntry mType =  member.type ();

    if (mType instanceof PrimitiveEntry)
      helperType = Util.javaName (entry);
    else
      helperType = Util.javaName (mType);
  }
  else
    helperType = Util.javaName (entry);
}
 
Example #17
Source File: Helper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize variables unique to this generator.
 **/
protected void init ()
{
  helperClass = entry.name () + "Helper";
  if (entry instanceof ValueBoxEntry)
  {
    ValueBoxEntry v = (ValueBoxEntry) entry;
    TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
    SymtabEntry mType =  member.type ();

    if (mType instanceof PrimitiveEntry)
      helperType = Util.javaName (entry);
    else
      helperType = Util.javaName (mType);
  }
  else
    helperType = Util.javaName (entry);
}
 
Example #18
Source File: Holder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example #19
Source File: Helper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize variables unique to this generator.
 **/
protected void init ()
{
  helperClass = entry.name () + "Helper";
  if (entry instanceof ValueBoxEntry)
  {
    ValueBoxEntry v = (ValueBoxEntry) entry;
    TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
    SymtabEntry mType =  member.type ();

    if (mType instanceof PrimitiveEntry)
      helperType = Util.javaName (entry);
    else
      helperType = Util.javaName (mType);
  }
  else
    helperType = Util.javaName (entry);
}
 
Example #20
Source File: Helper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #21
Source File: StructGen.java    From openjdk-jdk8u 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)
{
  if (thisIsReallyAnException)
  {
    stream.println (indent + "// write the repository ID");
    stream.println (indent + "ostream.write_string (id ());");
  }

  Vector members = ((StructEntry)entry).members ();
  for (int i = 0; i < members.size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)members.elementAt (i);
    SymtabEntry  mType = member.type ();

    if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
         mType instanceof TypedefEntry || mType instanceof PrimitiveEntry ||
         mType instanceof StringEntry)
      index = ((JavaGenerator)member.generator ()).write (index, "    ", name + '.' + member.name (), member, stream);

    // <d62023-klr> for corbaLevel 2.4 and up, use Helper.write like
    //                everything else
    else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
              && !Util.corbaLevel (2.4f, 99.0f)) { // <d62023>
      stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // <d60929>
                      + name + '.' + member.name () + ", "
                      + Util.helperName (member.type (), true) // <d61056>
                      + ".get_instance ());"); // <d61056>
    }
    else
      stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // <d61056>
  }
  return index;
}
 
Example #22
Source File: ValueBoxGen24.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  stream.println ("    if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM(); }");
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);");
  stream.println ("  }");
  stream.println ();

  // done with "read", now do "read_value with real marshalling code.

  stream.println ("  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
  stream.println ("  {");

  String indent = "    ";
  Vector vMembers = ((ValueBoxEntry) entry).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry ||
      mType instanceof SequenceEntry ||
      mType instanceof TypedefEntry ||
      mType instanceof StringEntry ||
      !member.arrayInfo ().isEmpty ()) {
    stream.println (indent + Util.javaName (mType) + " tmp;");
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);");
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return (java.io.Serializable) tmp;");
}
 
Example #23
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
static void fillValueBoxInfo (ValueBoxEntry vb)
{
  SymtabEntry stateMember = (((InterfaceState) vb.state ().elementAt (0)).entry);
  if (stateMember.type() != null)
    Util.fillInfo (stateMember.type ());
  Util.fillInfo (stateMember);
}
 
Example #24
Source File: Helper24.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * d62023 - generate members of BoxedValueHelper interface if boxed
 *
 * d62023 - hook in here to write factory methods for non-boxed ValueTypes
 *          into Helper.
 **/
protected void writeValueHelperInterface ()
{
  if (entry instanceof ValueBoxEntry) {
      writeGetID ();
  } else if (entry instanceof ValueEntry) {
      writeHelperFactories ();
  }
}
 
Example #25
Source File: Holder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate members of this class.
 **/
protected void writeBody ()
{
  if (entry instanceof ValueBoxEntry)
    stream.println ("  public " + holderType + " value;");
  else
    Util.writeInitializer ("  public ", "value", "", entry, stream);
  stream.println ();
  writeCtors ();
  writeRead ();
  writeWrite ();
  writeType ();
}
 
Example #26
Source File: Helper24.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Generate constructors only for boxed valuetype helpers
 *            All other helpers are abstract.
 **/
protected void writeCtors ()
{
  if (entry instanceof ValueBoxEntry) {
      stream.println ("  public " + helperClass + "()");
      stream.println ("  {");
      stream.println ("  }");
      stream.println ();
  }
}
 
Example #27
Source File: Helper24.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the instance variables.
 * <d62023> - no helper instance except for boxed valuetypes.
 *          - move truncatable_ids to mapped class.
 **/
protected void writeInstVars ()
{
  stream.println ("  private static String  _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
  if (entry instanceof ValueEntry)
  {
    stream.println ();
    if (entry instanceof ValueBoxEntry) {
        stream.println ("  private static " + helperClass + " _instance = new " + helperClass + " ();");
        stream.println ();
    }
  }
  stream.println ();
}
 
Example #28
Source File: Holder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the _write method.
 **/
protected void writeWrite ()
{
  stream.println ("  public void _write (org.omg.CORBA.portable.OutputStream o)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    o.write_string (value);");

    else if (mType instanceof PrimitiveEntry)
    {
      String name = entry.name ();
      stream.println ("    " + name + " vb = new " + name + " (value);");
      stream.println ("    " + helperClass + ".write (o, vb);");
    }

    else
      stream.println ("    " + helperClass + ".write (o, value);");
  }
  else
    stream.println ("    " + helperClass + ".write (o, value);");
  stream.println ("  }");
  stream.println ();
}
 
Example #29
Source File: Holder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize variables unique to this generator.
 **/
protected void init ()
{
  holderClass = entry.name () + "Holder";
  helperClass = Util.helperName (entry, true); // <d61056>
  if (entry instanceof ValueBoxEntry)
  {
    ValueBoxEntry v = (ValueBoxEntry) entry;
    TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
    SymtabEntry mType =  member.type ();
    holderType = Util.javaName (mType);
  }
  else
    holderType = Util.javaName (entry);
}
 
Example #30
Source File: Helper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}