com.monoserv
Class InstanceModifier

java.lang.Object
  extended by com.monoserv.InstanceModifier

public class InstanceModifier
extends java.lang.Object

Allows the modules to set fields which will force the MonoServerInstance to react based on the fields set. Tied to the module and optional. Also has a DISABLE_FIELD that is only used during merging. This allows you to explicity disable features if they have been enable previously. All manipulations are done using bitwise operators. Thanks to Chris Shotwell at Avalon-X for assisting with the merge section.


Constructor Summary
InstanceModifier()
          Blank constructor
 
Method Summary
 boolean closeSocketAfterSend()
          Determines if the socket should be closed after the data stream has been written and flushed.
 void disableCloseSocketAfterSend()
          Tells the MonoServerInstance to not close the socket after the data stream has been written and flushed.
 void enableCloseSocketAfterSend()
          Tells the MonoServerInstance to close the socket after the data stream has been written and flushed.
 int getBitField()
          Returns the BIT_FIELD value stored in the object.
 int getDisableField()
          Only used when merging two InstanceModifier objects together.
 void merge(InstanceModifier im)
          Takes the internal bits of the supplied InstanceModifier and applies them to this BIT_FIELD.
 void setModifier(InstanceModifier im)
          Sets the internal bits according to the supplied copy of the InstanceModifier This will clear all the bits and copy the bits that are set in the instance modifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceModifier

public InstanceModifier()
Blank constructor

Method Detail

enableCloseSocketAfterSend

public void enableCloseSocketAfterSend()
Tells the MonoServerInstance to close the socket after the data stream has been written and flushed.


disableCloseSocketAfterSend

public void disableCloseSocketAfterSend()
Tells the MonoServerInstance to not close the socket after the data stream has been written and flushed. Exact opposite of enableCloseSocketAfterSend()


getDisableField

public int getDisableField()
Only used when merging two InstanceModifier objects together. Its used for explicitly disabling previously set options.

Returns:
int The value of DISABLE_FIELD

closeSocketAfterSend

public boolean closeSocketAfterSend()
Determines if the socket should be closed after the data stream has been written and flushed.

Returns:
boolean true if we are to close the socket, false otherwise.

getBitField

public int getBitField()
Returns the BIT_FIELD value stored in the object. This is the "ENABLE" field that indicates what options were turned on.

Returns:
char A character value representing the bits set in the object

setModifier

public void setModifier(InstanceModifier im)
Sets the internal bits according to the supplied copy of the InstanceModifier This will clear all the bits and copy the bits that are set in the instance modifier

Parameters:
im - The instance modifier to replace this object with.

merge

public void merge(InstanceModifier im)
Takes the internal bits of the supplied InstanceModifier and applies them to this BIT_FIELD. The supplied bit field takes precendence. Anything supplied in the enable first is first applied, and then the disable field is applied. If you pass null, the BIT_FIELD will remain unchanged.

Parameters:
im - The object to merge with the current object