public Policy create_policy( int type, Any any )
throws PolicyError
{
if( type != BIDIRECTIONAL_POLICY_TYPE.value )
{
throw new PolicyError("Invalid policy type of " + type,
BAD_POLICY.value );
}
short value = BidirectionalPolicyValueHelper.extract( any );
if( value != NORMAL.value &&
value != BOTH.value )
{
throw new PolicyError("Invalid value for BiDir policy of " + value,
BAD_POLICY_VALUE.value);
}
return new BiDirPolicy( value );
}