/**
  * Deserializes a NIS boot info.
  *
  * @param deserializer The deserializer.
  */
 public NisBootInfo(final Deserializer deserializer) {
   // To provide a smooth transition from old structure
   final Integer bootStrategy = deserializer.readOptionalInt("bootNis");
   this.bootStrategy = null == bootStrategy ? 0 : bootStrategy;
   this.accountId = deserializer.readOptionalString("account");
   this.nodeName = deserializer.readOptionalString("nodeName");
 }
  /**
   * Sets the fields based on deserializer.
   *
   * @param deserializer The deserializer.
   */
  public void deserialize(final Deserializer deserializer, final boolean remoteIsOptional) {
    this.setLanguage(deserializer.readString("language"));
    if (remoteIsOptional) {
      this.setNisEndpoint(deserializer.readOptionalObject("remoteServer", NodeEndpoint::new));
    } else {
      this.setNisEndpoint(deserializer.readObject("remoteServer", NodeEndpoint::new));
    }
    this.setNisBootInfo(deserializer.readObject("nisBootInfo", NisBootInfo::new));

    this.setFirstStart(deserializer.readOptionalInt("firstStart"));
  }
Esempio n. 3
0
  /**
   * Deserializes a transaction.
   *
   * @param options The deserialization options.
   * @param deserializer The deserializer.
   * @return The deserialized transaction.
   */
  private static Transaction deserialize(
      final VerifiableEntity.DeserializationOptions options, final Deserializer deserializer) {
    final int type = deserializer.readInt("type");

    final BiFunction<VerifiableEntity.DeserializationOptions, Deserializer, Transaction>
        constructor = TYPE_TO_CONSTRUCTOR_MAP.getOrDefault(type, null);
    if (null == constructor) {
      throw new IllegalArgumentException("Unknown transaction type: " + type);
    }

    return constructor.apply(options, deserializer);
  }