コード例 #1
0
  @Override
  public boolean deSerializeContents(IDeserializer deserializer) {
    boolean bRet = true;
    try {
      boolean isArray = deserializer.getIsArray(this.getInstanceName());
      int sizeOfArray = 0;

      if (isArray) {
        sizeOfArray = deserializer.getSize(this.getInstanceName());
        for (int i = 0; i < sizeOfArray; i++) {
          deserializer.setCurrentProperty(this.getInstanceName(), i);

          gen.xsd.DayType el;

          el = new gen.xsd.DayType();
          el.value = deserializer.getStringPropertyValue(this.getInstanceName());
          bRet = el.validateContent();
          if (!bRet) {
            deserializer.setErrorMessage(
                " Parameter Contains Invalid Value : " + this.getInstanceName());
            break;
          }

          members.add(el);
        }
      } else {
        if (true == deserializer.hasProperty(this.getInstanceName())) {
          gen.xsd.DayType el;

          el = new gen.xsd.DayType();
          el.value = deserializer.getStringPropertyValue(this.getInstanceName());
          bRet = el.validateContent();
          if (!bRet) {
            deserializer.setErrorMessage(
                " Parameter Contains Invalid Value : " + this.getInstanceName());
            return false;
          }

          members.add(el);
        }
      }
    } catch (Exception e) {
      return false;
    }

    return bRet;
  }
コード例 #2
0
  /**
   * Deserializes data and prepares the Detection object contents.
   *
   * @param deserializer Deserializer object that provides methods to deserialize.
   * @return True if deserialization is successful / False if deserialization failed
   * @since 1.0.0
   */
  @Override
  public boolean deSerializeContents(IDeserializer deserializer) {
    boolean retValue = true;
    if (false == super.deSerializeContents(deserializer)) retValue = false;

    try {
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("motionDetectionInUse")) {
          if (bRet == true) {
            motionDetectionInUse = deserializer.getBoolPropertyValue("motionDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("motionDetected")) {
          if (deserializer.validateMandatory() == false) bRet = false;
          if (bRet == true) {
            motionDetected = deserializer.getBoolPropertyValue("motionDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("motionSensitivity")) {
          if (bRet == true) {
            motionSensitivity = deserializer.getUnsignedByte("motionSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("maxMotionSensitivity")) {
          if (deserializer.validateMandatory() == false) bRet = false;
          if (bRet == true) {
            maxMotionSensitivity = deserializer.getUnsignedByte("maxMotionSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("soundDetectionInUse")) {
          if (bRet == true) {
            soundDetectionInUse = deserializer.getBoolPropertyValue("soundDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("soundDetected")) {
          if (deserializer.validateMandatory() == false) bRet = false;
          if (bRet == true) {
            soundDetected = deserializer.getBoolPropertyValue("soundDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("soundSensitivity")) {
          if (bRet == true) {
            soundSensitivity = deserializer.getUnsignedByte("soundSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("maxSoundSensitivity")) {
          if (deserializer.validateMandatory() == false) bRet = false;
          if (bRet == true) {
            maxSoundSensitivity = deserializer.getUnsignedByte("maxSoundSensitivity");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("barrierDetectionInUse")) {
          if (bRet == true) {
            barrierDetectionInUse = deserializer.getBoolPropertyValue("barrierDetectionInUse");
          }
        }
        if (retValue == true) retValue = bRet;
      }
      {
        boolean bRet = true;
        if (true == deserializer.hasProperty("barrierDetected")) {
          if (deserializer.validateMandatory() == false) bRet = false;
          if (bRet == true) {
            barrierDetected = deserializer.getBoolPropertyValue("barrierDetected");
          }
        }
        if (retValue == true) retValue = bRet;
      }
    } catch (Exception e) {
      return false;
    }
    return retValue;
  }