public static final class DOFInterface.Builder
extends java.lang.Object
DOFInterface iface = new Builder( iid )
.addProperty(...)
.addProperty(...)
.addMethod(...)
.addEvent(...)
.addException(...)
.build();
Constructor and Description |
---|
Builder(DOFInterfaceID iid)
Construct a Builder with an interface ID.
|
Builder(DOFInterfaceID iid,
byte[] data)
Construct a builder from its serialized byte array form.
|
Builder(DOFMarshalContext context,
java.lang.Object state,
DOFPacket packet)
Create a Builder from serial form.
|
Modifier and Type | Method and Description |
---|---|
DOFInterface.Builder |
addEvent(int itemID,
DOFType... parameters)
Add an Event to the Interface.
|
DOFInterface.Builder |
addException(int itemID,
DOFType... parameters)
Add an Exception to the Interface.
|
DOFInterface.Builder |
addMethod(int itemID,
DOFType[] inputParameters,
DOFType[] outputParameters)
Add a Method to the Interface.
|
DOFInterface.Builder |
addProperty(int itemID,
boolean isWritable,
boolean isReadable,
DOFType type)
Add a Property to the Interface.
|
DOFInterface |
build()
Construct a new DOFInterface based on the builder's current set of properties, methods,
events and exceptions.
|
public Builder(DOFInterfaceID iid, byte[] data) throws java.lang.Exception
iid
- The interface identifier. This may be null, but passing null will create an invalid interface
definition. This can be done temporarily if another DOFInterface will be created later using the same raw
data but after the interface identifier is known.data
- The serialized data. This must not be null.java.lang.Exception
- On illegal arguments.public Builder(DOFMarshalContext context, java.lang.Object state, DOFPacket packet) throws java.lang.Exception
context
- The context of the unmarshalling to be performed.state
- The state in which the unmarshalling is done. This may affect the result.packet
- The buffer which contains the serialized form of the object. Must not be null.DOFMarshalException
- If there are errors in the data or the buffer. This is an exception to the rule that
non-RuntimeExceptions not be thrown from a constructor.java.lang.Exception
Marshallable
public Builder(DOFInterfaceID iid)
iid
- The interface ID. Must not be null.public DOFInterface.Builder addProperty(int itemID, boolean isWritable, boolean isReadable, DOFType type)
itemID
- A number from 0 - 32,767 that identifies this interface item. This must be unique within a
DOFInterface (no other Typedef, Property, Method, Event, or Exception may use the same ID).isWritable
- Is the property writable?isReadable
- Is the property readable?type
- The type of the property. Must not be null.DOFType
public DOFInterface.Builder addEvent(int itemID, DOFType... parameters)
itemID
- A number from 0 - 32,767 that identifies this interface item. This must be unique within a
DOFInterface (no other Typedef, Property, Method, Event, or Exception may use the same ID).parameters
- The Parameters for this Event. May be omitted to indicate no parameters.public DOFInterface.Builder addMethod(int itemID, DOFType[] inputParameters, DOFType[] outputParameters)
itemID
- A number from 0 - 32,767 that identifies this interface item. This must be unique within a
DOFInterface (no other Typedef, Property, Method, Event, or Exception may use the same ID).inputParameters
- The method's Input Parameters. Null == none.outputParameters
- The method's Output Parameters. Null == none.public DOFInterface.Builder addException(int itemID, DOFType... parameters)
itemID
- A number from 0 - 32,767 that identifies this interface item. This must be unique within a
DOFInterface (no other Typedef, Property, Method, Event, or Exception may use the same ID).parameters
- The Parameters for this Exception. May be omitted to indicate no parameters.public DOFInterface build()