code: public void encodeData(AsnOutputStream asnOs) throws MAPException {
  
          try {
              if (this.choice == null)
                  throw new MAPException("Error while encoding the " + _PrimitiveName + ": choice is not defined");
  
              if ((this.choice == PSSubscriberStateChoice.psPDPActiveNotReachableForPaging || this.choice == PSSubscriberStateChoice.psPDPActiveReachableForPaging)
                      && this.pdpContextInfoList == null)
                  throw new MAPException(
                          "Error while encoding the "
                                  + _PrimitiveName
                                  + ": for choice psPDPActiveNotReachableForPaging or psPDPActiveReachableForPaging - pdpContextInfoList must not be null");
  
              if ((this.choice == PSSubscriberStateChoice.netDetNotReachable) && this.netDetNotReachable == null)
                  throw new MAPException("Error while encoding the " + _PrimitiveName
                          + ": for choice netDetNotReachable - netDetNotReachable must not be null");
  
              switch (this.choice) {
                  case notProvidedFromSGSNorMME:
                  case psDetached:
                  case psAttachedNotReachableForPaging:
                  case psAttachedReachableForPaging:
                      asnOs.writeNullData();
                      break;
                  case psPDPActiveNotReachableForPaging:
                  case psPDPActiveReachableForPaging:
  
                      if (this.pdpContextInfoList.size() < 1 || this.pdpContextInfoList.size() > 50)
                          throw new MAPException("Error while encoding " + _PrimitiveName
                                  + ": pdpContextInfoList size must be from 1 to 50");
  
                      for (PDPContextInfo cii : this.pdpContextInfoList) {
                          PDPContextInfoImpl ci = (PDPContextInfoImpl) cii;
                          ci.encodeAll(asnOs);
                      }
                      break;
                  case netDetNotReachable:
                      asnOs.writeIntegerData(this.netDetNotReachable.getCode());
                      break;
              }
  
          } catch (IOException e) {
              throw new MAPException("IOException when encoding " + _PrimitiveName + ": " + e.getMessage(), e);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.protocols.ss7.map.primitives.MAPAsnPrimitive#encodeData (org.mobicents.protocols.asn.AsnOutputStream)