Пример #1
0
  @Override
  public boolean serializeContents(ISerializer serializer) {
    boolean bRet = true;

    try {
      serializer.startListProperty(this.getInstanceName());

      for (gen.xsd.DayType itr : members) {

        bRet = (itr).validateContent();
        if (bRet) bRet = serializer.setStringPropertyValue(this.getInstanceName(), itr.value);

        if (bRet == false) {
          serializer.setErrorMessage(
              " Parameter Contains Invalid Value : " + this.getInstanceName());
          break;
        }
      }
      serializer.endListProperty(this.getInstanceName());
    } catch (Exception e) {
      return false;
    }

    return bRet;
  }
Пример #2
0
  /**
   * Serializes the contents of Detection object.
   *
   * @param serializer Serializer object that provides methods to serialize.
   * @return True if serialization is successful / False if serialization failed
   * @since 1.0.0
   */
  @Override
  public boolean serializeContents(ISerializer serializer) {
    boolean retValue = true;
    if (false == super.serializeContents(serializer)) retValue = false;

    try {
      {
        boolean bRet = true;
        if (null != motionDetectionInUse) {
          bRet = serializer.setBoolPropertyValue("motionDetectionInUse", motionDetectionInUse);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " motionDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      if (serializer.validateMandatory() == true) {
        boolean bRet = true;
        if (null != motionDetected) {
          bRet = serializer.setBoolPropertyValue("motionDetected", motionDetected);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " motionDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (null != motionSensitivity) {
          bRet = serializer.setUnsignedByte("motionSensitivity", motionSensitivity);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " motionSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      if (serializer.validateMandatory() == true) {
        boolean bRet = true;
        if (null != maxMotionSensitivity) {
          bRet = serializer.setUnsignedByte("maxMotionSensitivity", maxMotionSensitivity);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " maxMotionSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (null != soundDetectionInUse) {
          bRet = serializer.setBoolPropertyValue("soundDetectionInUse", soundDetectionInUse);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " soundDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      if (serializer.validateMandatory() == true) {
        boolean bRet = true;
        if (null != soundDetected) {
          bRet = serializer.setBoolPropertyValue("soundDetected", soundDetected);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " soundDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (null != soundSensitivity) {
          bRet = serializer.setUnsignedByte("soundSensitivity", soundSensitivity);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " soundSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      if (serializer.validateMandatory() == true) {
        boolean bRet = true;
        if (null != maxSoundSensitivity) {
          bRet = serializer.setUnsignedByte("maxSoundSensitivity", maxSoundSensitivity);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " maxSoundSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (null != barrierDetectionInUse) {
          bRet = serializer.setBoolPropertyValue("barrierDetectionInUse", barrierDetectionInUse);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " barrierDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      if (serializer.validateMandatory() == true) {
        boolean bRet = true;
        if (null != barrierDetected) {
          bRet = serializer.setBoolPropertyValue("barrierDetected", barrierDetected);
          if (false == bRet) {
            serializer.setErrorMessage(
                "Failed To Serialize parameter (Invalid content) : " + " barrierDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
    } catch (Exception e) {
      return false;
    }
    return retValue;
  }