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

The following examples show how to use com.sun.tools.corba.se.idl.ValueEntry. 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: 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 #2
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example #3
Source File: ValueGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.v = v;
  init ();

  openStream ();
  if (stream == null)
    return;
  generateTie ();
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example #4
Source File: Helper.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the heading, including package, imports, class statements,
 * and open curly.
 **/
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);

  stream.print ("public final class " + helperClass);
  if (entry instanceof ValueEntry)
    stream.println (" implements org.omg.CORBA.portable.ValueHelper");
  else
    stream.println ();
  stream.println ('{');
}
 
Example #5
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example #6
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example #7
Source File: Skeleton.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize members unique to this generator.
 **/
protected void init ()
{
  tie = ((Arguments)Compile.compiler.arguments).TIEServer ;
  poa = ((Arguments)Compile.compiler.arguments).POAServer ;

  skeletonNameModifier =
      ((Arguments)Compile.compiler.arguments).skeletonNameModifier ;
  tieNameModifier =
      ((Arguments)Compile.compiler.arguments).tieNameModifier ;

  tieClassName = tieNameModifier.makeName( i.name() ) ;
  skeletonClassName = skeletonNameModifier.makeName( i.name() ) ;

  intfName = Util.javaName (i);
  // for valuetype, get the name of the interface the valuetype supports
  if (i instanceof ValueEntry)
  {
    ValueEntry v = (ValueEntry) i;
    InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
    intfName = Util.javaName (intf);
  }
}
 
Example #8
Source File: ValueBoxGen.java    From hottub 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 #9
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 #10
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example #11
Source File: ValueGen24.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <62023> - generate factory interface and default factory
 **/
public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.v = v;
  init ();

  openStream ();
  if (stream == null)
    return;
  generateTie ();
  generateHelper ();
  generateHolder ();
  if (!v.isAbstract ()) {
    generateValueFactory ();
    generateDefaultFactory ();
  }
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example #12
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 #13
Source File: Helper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate members of this class.
 **/
protected void writeBody ()
{
  writeInstVars ();
  writeCtors ();
  writeInsert ();
  writeExtract ();
  writeType ();
  writeID ();
  writeRead ();
  writeWrite ();
  if (entry instanceof InterfaceEntry && !(entry instanceof ValueEntry)) {
    writeNarrow ();
    writeUncheckedNarrow ();
  }
  writeHelperInterface ();
  if (entry instanceof ValueEntry)
    writeValueHelperInterface ();
}
 
Example #14
Source File: Skeleton.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize members unique to this generator.
 **/
protected void init ()
{
  tie = ((Arguments)Compile.compiler.arguments).TIEServer ;
  poa = ((Arguments)Compile.compiler.arguments).POAServer ;

  skeletonNameModifier =
      ((Arguments)Compile.compiler.arguments).skeletonNameModifier ;
  tieNameModifier =
      ((Arguments)Compile.compiler.arguments).tieNameModifier ;

  tieClassName = tieNameModifier.makeName( i.name() ) ;
  skeletonClassName = skeletonNameModifier.makeName( i.name() ) ;

  intfName = Util.javaName (i);
  // for valuetype, get the name of the interface the valuetype supports
  if (i instanceof ValueEntry)
  {
    ValueEntry v = (ValueEntry) i;
    InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
    intfName = Util.javaName (intf);
  }
}
 
Example #15
Source File: ValueGen24.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <62023> - generate factory interface and default factory
 **/
public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.v = v;
  init ();

  openStream ();
  if (stream == null)
    return;
  generateTie ();
  generateHelper ();
  generateHolder ();
  if (!v.isAbstract ()) {
    generateValueFactory ();
    generateDefaultFactory ();
  }
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example #16
Source File: Helper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the instance variables.
 **/
protected void writeInstVars ()
{
  stream.println ("  private static String  _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
  if (entry instanceof ValueEntry)
  {
    stream.println ();
    stream.println ("  private static " + helperClass + " helper = new " + helperClass + " ();");
    stream.println ();
    stream.println ("  private static String[] _truncatable_ids = {");
    stream.print   ("    _id");

    // Any safe ValueEntry must have a concete value parent.
    // The topmost parent cannot be safe since it doesn't have
    // a concrete parent.
    ValueEntry child = (ValueEntry) entry;
    while (child.isSafe ())
    {
      stream.println(",");
      ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
      stream.print("    \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
      child = parent;
    }
    stream.println("   };");
  }
  stream.println ();
}
 
Example #17
Source File: DefaultFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate members of this class.
 **/
protected void writeFactoryMethods ()
{
  Vector init = ((ValueEntry)entry).initializers ();
  if (init != null)
  {
    for (int i = 0; i < init.size (); i++)
    {
      MethodEntry element = (MethodEntry) init.elementAt (i);
      element.valueMethod (true); //tag value method if not tagged previously
      ((MethodGen24) element.generator ()).defaultFactoryMethod (symbolTable, element, stream);
    }
  }
}
 
Example #18
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d61056>
 **/
public static String helperName (SymtabEntry entry, boolean qualifiedName)
{
  if (entry instanceof ValueEntry)
    if (entry.name ().equals ("ValueBase"))
        return "org.omg.CORBA.ValueBaseHelper";

  if (qualifiedName)
    return javaQualifiedName (entry) + "Helper";
  else
    return javaName (entry) + "Helper";
}
 
Example #19
Source File: ValueGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static String getValueModifier (ValueEntry vt)
{
  String mod = "NONE";
  if (vt.isCustom ())
    mod = "CUSTOM";
  else if (vt.isAbstract ())
    mod = "ABSTRACT";
  else if (vt.isSafe ())
    mod = "TRUNCATABLE";
  return "org.omg.CORBA.VM_" + mod + ".value";
}
 
Example #20
Source File: ValueGen.java    From openjdk-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)
{
  // First do the state members from concrete parent hierarchy
  Vector vParents = ((ValueEntry)entry).derivedFrom ();
  if (vParents != null && vParents.size () != 0)
  {
    ValueEntry parent = (ValueEntry)vParents.elementAt (0);
    if (parent == null)
      return index;
    // Per Simon, 4/06/99 - call parent write. <d60929>
    // Per Simon, 4/27/99 - call parent _write. <d62062>
    if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
        stream.println(indent + Util.helperName (parent, true) + "._write (ostream, value);"); // <d60929> <d61056> <d62062>
  }

  Vector vMembers = ((ValueEntry) entry ).state ();
  int noOfMembers = vMembers == null ? 0 : vMembers.size ();
  for (int k = 0; k < noOfMembers; k++)
  {
    TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
    String memberName = member.name ();
    SymtabEntry mType = member.type ();

    if (mType instanceof PrimitiveEntry ||
        mType instanceof TypedefEntry   ||
        mType instanceof SequenceEntry  ||
        mType instanceof StringEntry    ||
        !member.arrayInfo ().isEmpty ())
      index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
    else
      stream.println (indent + Util.helperName (mType, true) + // <d61056>
                            ".write (ostream, " + name + '.' + memberName + ");");
  }

  return index;
}
 
Example #21
Source File: ValueBoxGen.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)
{
// <d59418 - KLR> per Simon, make "static" read call istream.read_value.
//                put real marshalling code in read_value.
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
  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 ("  {");
  // end of <d59418> changes

  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;"); // <d62023>
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" +
                    Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);"); // <d61056>
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return tmp;");
}
 
Example #22
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public static String holderName (SymtabEntry entry)
{
  String name;
  if (entry instanceof PrimitiveEntry)
    if (entry.name ().equals ("any"))
      name = "org.omg.CORBA.AnyHolder";
    else if (entry.name ().equals ("TypeCode"))
      name = "org.omg.CORBA.TypeCodeHolder";
    else if (entry.name ().equals ("Principal")) // <d61961>
      name = "org.omg.CORBA.PrincipalHolder";
    else
      name = "org.omg.CORBA." + capitalize (javaQualifiedName (entry)) + "Holder";
  else if (entry instanceof TypedefEntry)
  {
    TypedefEntry td = (TypedefEntry)entry;
    if (!td.arrayInfo ().isEmpty () || td.type () instanceof SequenceEntry)
      name = javaQualifiedName (entry) + "Holder";
    else
      name = holderName (entry.type ());
  }
  else if (entry instanceof StringEntry)
    name = "org.omg.CORBA.StringHolder";
  else if (entry instanceof ValueEntry)
  {
    if (entry.name ().equals ("ValueBase"))
        name = "org.omg.CORBA.ValueBaseHolder"; // <d59421>, <d60929>
    else
        name = javaName (entry) + "Holder";
  } else if (entry instanceof NativeEntry) {
    // do not attach holder to the translation for Native Entries, e.g.
    // for Cookie it should be CookieHolder instead of java.lang.ObjectHolder
    // returns the complete name for the package, etc.
    name = javaQualifiedName(entry) + "Holder";
  }
  else
    name = javaName (entry) + "Holder";
  return name;
}
 
Example #23
Source File: ValueGen24.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> - Goes in mapped class, not Helper
 **/
protected void writeTruncatable () // <d60929>
{
  if (!v.isAbstract ()) {
     stream.println ("  private static String[] _truncatable_ids = {");
     stream.print   ("    " + Util.helperName(v, true) + ".id ()");

     // Any safe ValueEntry must have a concete value parent.
     // The topmost parent cannot be safe since it doesn't have
     // a concrete parent.
     ValueEntry child = v;
     while (child.isSafe ())
     {
      stream.println(",");
      ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
      stream.print("    \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
      child = parent;
    }
    stream.println();
    stream.println("  };");
    stream.println();
    stream.println ("  public String[] _truncatable_ids() {");
    stream.println ("    return _truncatable_ids;");
    stream.println ("  }");
    stream.println ();
  }
}
 
Example #24
Source File: MethodGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.m           = m;
  this.stream      = stream;
  if (m.comment () != null)
    m.comment ().generate ("", stream);
  stream.print ("  ");
  SymtabEntry container = (SymtabEntry)m.container ();
  boolean isAbstract = false;
  boolean valueContainer = false;
  if (container instanceof ValueEntry)
  {
    isAbstract = ((ValueEntry)container).isAbstract ();
    valueContainer = true;
  }
  if (valueContainer && !isAbstract)
    stream.print ("public ");
  writeMethodSignature ();
  if (valueContainer && !isAbstract)
  {
    stream.println ();
    stream.println ("  {");
    stream.println ("  }");
    stream.println ();
  }
  else
    stream.println (";");
}
 
Example #25
Source File: Helper24.java    From hottub 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 #26
Source File: ValueGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void helperWrite (SymtabEntry entry, PrintWriter stream)
  {
    // <d59418 - KLR> per Simon, make "static" write call istream.write_value.
    //              put real marshalling code in write_value.
    stream.println ("    ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // <d60929>
    stream.println ("  }");
    stream.println ();

    // <d62062>
    // per Simon, 4/27/99, add static _write that marshals the state of this
    //  value for non-custom valuetypes
    if (!((ValueEntry)entry).isCustom ())
    {
       stream.println ("  public static void _write (org.omg.CORBA.portable.OutputStream ostream, " + Util.javaName (entry) + " value)");
       stream.println ("  {");
       write (0, "    ", "value", entry, stream);
       stream.println ("  }");
       stream.println ();
    }

    // done with "_write", now do "write_value
    stream.println ("  public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // <d60929>
    stream.println ("  {");

    // per Simon, 3/3/99, write_value for custom values throws an exception
    if (((ValueEntry)entry).isCustom ())
    {
      stream.println ("    throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use marshal()\");");
    }
    else {
      String entryName = Util.javaName(entry);
      stream.println ("    _write (ostream, (" + entryName + ") obj);"); // <d62062>
//      write (0, "    ", "value", entry, stream); <d62062>
    }
  }
 
Example #27
Source File: ValueGen24.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * d62023 - goes in mapped class, not Helper
 **/
protected void writeTruncatable () // <d60929>
{
  if (!v.isAbstract ()) {
     stream.println ("  private static String[] _truncatable_ids = {");
     stream.print   ("    " + Util.helperName(v, true) + ".id ()");

     // Any safe ValueEntry must have a concete value parent.
     // The topmost parent cannot be safe since it doesn't have
     // a concrete parent.
     ValueEntry child = v;
     while (child.isSafe ())
     {
      stream.println(",");
      ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
      stream.print("    \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
      child = parent;
    }
    stream.println();
    stream.println("  };");
    stream.println();
    stream.println ("  public String[] _truncatable_ids() {");
    stream.println ("    return _truncatable_ids;");
    stream.println ("  }");
    stream.println ();
  }
}
 
Example #28
Source File: DefaultFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate members of this class.
 **/
protected void writeFactoryMethods ()
{
  Vector init = ((ValueEntry)entry).initializers ();
  if (init != null)
  {
    for (int i = 0; i < init.size (); i++)
    {
      MethodEntry element = (MethodEntry) init.elementAt (i);
      element.valueMethod (true); //tag value method if not tagged previously
      ((MethodGen24) element.generator ()).defaultFactoryMethod (symbolTable, element, stream);
    }
  }
}
 
Example #29
Source File: ValueGen24.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Call super._write()
 **/
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  // First do the state members from concrete parent hierarchy
  Vector vParents = ((ValueEntry)entry).derivedFrom ();
  if (vParents != null && vParents.size () != 0)
  {
    ValueEntry parent = (ValueEntry)vParents.elementAt (0);
    if (parent == null)
      return index;
    // call super._read if non-abstract value parent
    if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
        stream.println(indent + "super._write (ostream);");
  }

  Vector vMembers = ((ValueEntry) entry ).state ();
  int noOfMembers = vMembers == null ? 0 : vMembers.size ();
  for (int k = 0; k < noOfMembers; k++)
  {
    TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
    String memberName = member.name ();
    SymtabEntry mType = member.type ();

    if (mType instanceof PrimitiveEntry ||
        mType instanceof TypedefEntry   ||
        mType instanceof SequenceEntry  ||
        mType instanceof StringEntry    ||
        !member.arrayInfo ().isEmpty ())
      index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
    else
      stream.println (indent + Util.helperName (mType, true) + // <d61056>
                            ".write (ostream, " + name + '.' + memberName + ");");
  }

  return index;
}
 
Example #30
Source File: ValueBoxGen24.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
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
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}