corba/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java
changeset 30383 45960fdbe465
parent 25862 a5e25d68f971
equal deleted inserted replaced
30073:989253a902c3 30383:45960fdbe465
    71   public ValueGen24 ()
    71   public ValueGen24 ()
    72   {
    72   {
    73   } // ctor
    73   } // ctor
    74 
    74 
    75   /**
    75   /**
    76    * <d62023> - delete constructor; helper is abstract
    76    * d62023 - delete constructor; helper is abstract
    77    **/
    77    **/
    78   protected void writeConstructor ()
    78   protected void writeConstructor ()
    79   {
    79   {
    80   } // writeConstructor
    80   } // writeConstructor
    81 
    81 
    82   /**
    82   /**
    83    * <d62023> - delete write_value from non-boxed helpers
    83    * <pre>
    84    *          - delete _write from non-boxed helpers
    84    * d62023 - delete write_value from non-boxed helpers
       
    85    *        - delete _write from non-boxed helpers
       
    86    * </pre>
    85    **/
    87    **/
    86   public void helperWrite (SymtabEntry entry, PrintWriter stream)
    88   public void helperWrite (SymtabEntry entry, PrintWriter stream)
    87   {
    89   {
    88     // REVISIT: Abstract/Custom??
    90     // REVISIT: Abstract/Custom??
    89     // per Simon mail 5/17/99
    91     // per Simon mail 5/17/99
    90     stream.println ("    ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());");
    92     stream.println ("    ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());");
    91   } // helperWrite
    93   } // helperWrite
    92 
    94 
    93   /**
    95   /**
    94    * <d62023>
    96    * d62023
    95    **/
    97    **/
    96   public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
    98   public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
    97   {
    99   {
    98     // REVISIT: Abstract/Custom??
   100     // REVISIT: Abstract/Custom??
    99     // per Simon mail 5/17/99
   101     // per Simon mail 5/17/99
   100     stream.println ("    return (" + entryName + ")((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());");
   102     stream.println ("    return (" + entryName + ")((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());");
   101   } // helperRead
   103   } // helperRead
   102 
   104 
   103   /**
   105   /**
   104    * <d62023> - suppress initializers from mapped value; now generated in
   106    * d62023 - suppress initializers from mapped value; now generated in
   105    *    the Helper class and Factory class
   107    *    the Helper class and Factory class
   106    **/
   108    **/
   107   protected void writeInitializers ()
   109   protected void writeInitializers ()
   108   {
   110   {
   109         // override to do nothing
   111         // override to do nothing
   110   } // writeInitializers
   112   } // writeInitializers
   111 
   113 
   112   /**
   114   /**
   113    * <d62023> - Goes in mapped class, not Helper
   115    * d62023 - goes in mapped class, not Helper
   114    **/
   116    **/
   115   protected void writeTruncatable () // <d60929>
   117   protected void writeTruncatable () // <d60929>
   116   {
   118   {
   117     if (!v.isAbstract ()) {
   119     if (!v.isAbstract ()) {
   118        stream.println ("  private static String[] _truncatable_ids = {");
   120        stream.println ("  private static String[] _truncatable_ids = {");
   153         stream.print( name ) ;
   155         stream.print( name ) ;
   154     }
   156     }
   155   }
   157   }
   156 
   158 
   157   /**
   159   /**
   158    * <d62023> CustomMarshal -> CustomValue for custom valuetypes
   160    * d62023 - CustomMarshal {@literal ->} CustomValue for custom valuetypes
   159    *          mapped class is abstract
   161    *          mapped class is abstract
   160    **/
   162    **/
   161   protected void writeHeading ()
   163   protected void writeHeading ()
   162   {
   164   {
   163     ImplStreamWriter isw = new ImplStreamWriter() ;
   165     ImplStreamWriter isw = new ImplStreamWriter() ;
   215     stream.println ();
   217     stream.println ();
   216     stream.println ("{");
   218     stream.println ("{");
   217   } // writeHeading
   219   } // writeHeading
   218 
   220 
   219   /**
   221   /**
   220    * <d62023> - private state maps to protected, not default
   222    * d62023 - private state maps to protected, not default
   221    **/
   223    **/
   222   protected void writeMembers ()
   224   protected void writeMembers ()
   223   {
   225   {
   224     // if the value type contains no data members, a null return is expected
   226     // if the value type contains no data members, a null return is expected
   225     if (v.state () == null)
   227     if (v.state () == null)
   243     }
   245     }
   244     stream.println();
   246     stream.println();
   245   } // writeMembers
   247   } // writeMembers
   246 
   248 
   247   /**
   249   /**
   248    * <d62023> Methods need to be abstract
   250    * d62023 - methods need to be abstract writeStreamable
   249    *          writeStreamable
       
   250    **/
   251    **/
   251   protected void writeMethods ()
   252   protected void writeMethods ()
   252   {
   253   {
   253     // contained vector contains methods, attributes, const, enums, exceptions,
   254     // contained vector contains methods, attributes, const, enums, exceptions,
   254     // structs, unions, or typedefs that are declared inside the value object.
   255     // structs, unions, or typedefs that are declared inside the value object.
   292   if (!(v.isCustom () || v.isAbstract ()))
   293   if (!(v.isCustom () || v.isAbstract ()))
   293       writeStreamableMethods ();
   294       writeStreamableMethods ();
   294   } // writeMethods
   295   } // writeMethods
   295 
   296 
   296   /**
   297   /**
   297    * <d62023> Call super._read()
   298    * d62023 - call super._read()
   298    **/
   299    **/
   299   public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
   300   public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
   300   {
   301   {
   301     // First do the state members from concrete parent hierarchy
   302     // First do the state members from concrete parent hierarchy
   302     Vector vParents = ((ValueEntry) entry).derivedFrom ();
   303     Vector vParents = ((ValueEntry) entry).derivedFrom ();
   333 
   334 
   334     return index;
   335     return index;
   335   } // read
   336   } // read
   336 
   337 
   337   /**
   338   /**
   338    * <d62023> Call super._write()
   339    * d62023 - call super._write()
   339    **/
   340    **/
   340   public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
   341   public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
   341   {
   342   {
   342     // First do the state members from concrete parent hierarchy
   343     // First do the state members from concrete parent hierarchy
   343     Vector vParents = ((ValueEntry)entry).derivedFrom ();
   344     Vector vParents = ((ValueEntry)entry).derivedFrom ();
   372 
   373 
   373     return index;
   374     return index;
   374   } // write
   375   } // write
   375 
   376 
   376   /**
   377   /**
   377    * <62023> - generate factory interface and default factory
   378    * d62023 - generate factory interface and default factory
   378    **/
   379    **/
   379   public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
   380   public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
   380   {
   381   {
   381     this.symbolTable = symbolTable;
   382     this.symbolTable = symbolTable;
   382     this.v = v;
   383     this.v = v;