Package org.acplt.oncrpc.apps.jrpcgen

# Class JrpcgenStruct

java.lang.Object
org.acplt.oncrpc.apps.jrpcgen.JrpcgenDocumentable
org.acplt.oncrpc.apps.jrpcgen.JrpcgenXdrDefinition
org.acplt.oncrpc.apps.jrpcgen.JrpcgenComplexType
org.acplt.oncrpc.apps.jrpcgen.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

## Nested Class Summary

## Nested classes/interfaces inherited from class org.acplt.oncrpc.apps.jrpcgen.JrpcgenXdrDefinition

`JrpcgenXdrDefinition.Table, JrpcgenXdrDefinition.Type`

## Field Summary

### Fields inherited from class org.acplt.oncrpc.apps.jrpcgen.JrpcgenDocumentable

`documentation`

## Constructor Summary

Constructors
Constructor
Description
`JrpcgenStruct(JrpcgenContext context, String identifier, JrpcgenDeclaration.Table elements)`
Constructs a `JrpcgenStruct` and sets the identifier and all its attribute elements.

## Method Summary

Modifier and Type
Method
Description
`void`
`dump()`
Dumps the structure together with its attribute elements to `System.out`.
`<T extends Appendable>
T`
`dump(T appendable)`
Dumps a description of the structure to the passed target object, which implements the appendable interface `Appendable`.
`void`
`generateJavaFile()`
Generates a Java file defining the class, which will represent an XDR struct.
`final JrpcgenDeclaration.Table`
`getElements()`
Returns the elements of this structure.
`String`
`toString()`
Returns a string representation of the structure.

### Methods inherited from class org.acplt.oncrpc.apps.jrpcgen.JrpcgenComplexType

`getDefinitionName, getJavaClass, getJavaName, getXdrClass, isBaseType, isBooleanType, isOpaqueType, isStringType, isVoid, writeEqualsExpression, writeJavaToXdr, writeJavaToXdr, writeXdrConstructorCall, writeXdrConstructorCall, writeXdrDecodingCall, writeXdrDynamicVectorDecodingCall, writeXdrDynamicVectorEncodingCall, writeXdrEncodingCall, writeXdrEncodingCall, writeXdrFixedVectorDecodingCall, writeXdrFixedVectorEncodingCall, writeXdrToJava, writeXdrVectorCodingMethods`

### Methods inherited from class org.acplt.oncrpc.apps.jrpcgen.JrpcgenXdrDefinition

`getIdentifier, getXdrType, isConst, isEnum, isStruct, isTypedef, isUnion`

### Methods inherited from class org.acplt.oncrpc.apps.jrpcgen.JrpcgenDocumentable

`appendDeprecatedOrNothing, appendDeprecatedOrNothing, documentationIsEmpty, documentationIsProvided, emptyDocumentation, getDocumentation, getIdentedDocu, getIdentedDocu, isDeprecated, writeDocumentation, writeDocumentation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## 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.