Class JrpcgenStruct

All Implemented Interfaces:
JrpcgenItem, JrpcgenTypeMapping

public class JrpcgenStruct extends JrpcgenComplexType
The JrpcgenStruct class represents a single structure defined in an rpcgen "x"-file.
Version:
$Revision: 1.1 $ $Date: 2003/08/13 12:03:47 $ $State: Exp $ $Locker: $
Author:
Harald Albrecht
  • Constructor Details

    • JrpcgenStruct

      public JrpcgenStruct(JrpcgenContext context, String identifier, JrpcgenDeclaration.Table elements)
      Constructs a JrpcgenStruct and sets the identifier and all its attribute elements.
      Parameters:
      context - The context the new struct belongs to.
      identifier - Identifier to be declared.
      elements - Table of declarations based on class JrpcgenDeclaration.
  • Method Details

    • getElements

      public final JrpcgenDeclaration.Table getElements()
      Returns the elements of this structure.
      Returns:
      The elements of this structure.
    • generateJavaFile

      public void generateJavaFile()
      Generates a Java file defining the class, which will represent an XDR struct. The generated class will implement the interface
      invalid reference
      XdrAble
      .

      At least, the generated class will offer members for the structure elements, a default constructor, a decoding constructor as well as an encoding and a decoding method. If the structure is used in a fixed and/or dynamic vector context, static methods providing encoding and decoding of a vector of the structure are additionally written. Dependant on the options the generated class may vary:

      • The option -ser (serializable) is given: The generated class will implement the interface
        invalid reference
        Serializable
      • The option -bean is given: The generated class will provide getters and setters to access the member fields. The member fields will have a reduced visibility allowing direct access to the struct and its extending classes, only.
      • The option -noToString is not given: The generated class will provide an own implementation of the toString()-method.
      • The option -noEquals is not given: The generated class will provide own implementations of the equlas()- and hash()-method.
      • The option -noValueCtor is not given: The generated class will provide a value constructor, which offers a parameter list corresponding to the elements of the structure.
      Specified by:
      generateJavaFile in class JrpcgenComplexType
    • toString

      public String toString()
      Returns a string representation of the structure.
      Overrides:
      toString in class Object
      Returns:
      A string describing the structure.
    • dump

      public void dump()
      Dumps the structure together with its attribute elements to System.out.
    • dump

      public <T extends Appendable> T dump(T appendable)
      Dumps a description of the structure to the passed target object, which implements the appendable interface Appendable.
      Type Parameters:
      T - A type extending or implementing the interface java.lang.Appendable.
      Parameters:
      appendable - An object of type T
      Returns:
      The passed object with a dump of this structure appended.