public Begin newInstance(Object described)
{
List l = (List) described;
Begin o = new Begin();
if(l.size() <= 3)
{
throw new DecodeException("The outgoing-window field cannot be omitted");
}
switch(8 - l.size())
{
case 0:
o.setProperties( (Map) l.get( 7 ) );
case 1:
Object val1 = l.get( 6 );
if( val1 == null || val1.getClass().isArray() )
{
o.setDesiredCapabilities( (Symbol[]) val1 );
}
else
{
o.setDesiredCapabilities( (Symbol) val1 );
}
case 2:
Object val2 = l.get( 5 );
if( val2 == null || val2.getClass().isArray() )
{
o.setOfferedCapabilities( (Symbol[]) val2 );
}
else
{
o.setOfferedCapabilities( (Symbol) val2 );
}
case 3:
UnsignedInteger handleMax = (UnsignedInteger) l.get(4);
o.setHandleMax(handleMax == null ? UnsignedInteger.MAX_VALUE : handleMax);
case 4:
o.setOutgoingWindow( (UnsignedInteger) l.get( 3 ) );
case 5:
o.setIncomingWindow( (UnsignedInteger) l.get( 2 ) );
case 6:
o.setNextOutgoingId( (UnsignedInteger) l.get( 1 ) );
case 7:
o.setRemoteChannel( (UnsignedShort) l.get( 0 ) );
}
return o;
}