Example #1
0
  public Builder toBuilder() {
    final Builder builder = newBuilder();

    if (id != null) {
      builder.setName(id.getName()).setVersion(id.getVersion());
    }

    return builder
        .setImage(image)
        .setHostname(hostname)
        .setCommand(command)
        .setEnv(env)
        .setResources(resources)
        .setPorts(ports)
        .setRegistration(registration)
        .setGracePeriod(gracePeriod)
        .setVolumes(volumes)
        .setExpires(expires)
        .setRegistrationDomain(registrationDomain)
        .setCreatingUser(creatingUser)
        .setToken(token)
        .setHealthCheck(healthCheck)
        .setSecurityOpt(securityOpt)
        .setNetworkMode(networkMode);
  }
Example #2
0
 /**
  * Creates a builder by populating it with data from the given {@link ParameterTypeContract}.
  *
  * @param contract the contract from which to populate this builder
  * @return an instance of the builder populated with data from the contract
  */
 public static Builder create(ParameterTypeContract contract) {
   Builder builder = new Builder(contract.getCode());
   builder.setName(contract.getName());
   builder.setActive(contract.isActive());
   builder.setVersionNumber(contract.getVersionNumber());
   builder.setObjectId(contract.getObjectId());
   return builder;
 }
 static boolean populateBuilderWithField(
     final InputReader reader, final Builder builder, final int fieldNumber) throws IOException {
   boolean fieldFound = true;
   switch (fieldNumber) {
     case fieldNumberId:
       builder.setId(reader.readInt(fieldNumber));
       break;
     case fieldNumberNumber2:
       builder.setNumber2(reader.readLong(fieldNumber));
       break;
     case fieldNumberName:
       builder.setName(reader.readString(fieldNumber));
       break;
     case fieldNumberBoolVal:
       builder.setBoolVal(reader.readBoolean(fieldNumber));
       break;
     case fieldNumberAmount:
       builder.setAmount(reader.readDouble(fieldNumber));
       break;
     case fieldNumberFloatNum:
       builder.setFloatNum(reader.readFloat(fieldNumber));
       break;
     case fieldNumberByteStringObj:
       builder.setByteStringObj(reader.readByteString(fieldNumber));
       break;
     case fieldNumberIdOptional:
       builder.setIdOptional(reader.readInt(fieldNumber));
       break;
     case fieldNumberNumber2Optional:
       builder.setNumber2Optional(reader.readLong(fieldNumber));
       break;
     case fieldNumberNameOptional:
       builder.setNameOptional(reader.readString(fieldNumber));
       break;
     case fieldNumberBoolValOptional:
       builder.setBoolValOptional(reader.readBoolean(fieldNumber));
       break;
     case fieldNumberAmountOptional:
       builder.setAmountOptional(reader.readDouble(fieldNumber));
       break;
     case fieldNumberFloatNumOptional:
       builder.setFloatNumOptional(reader.readFloat(fieldNumber));
       break;
     case fieldNumberByteStringObjOptional:
       builder.setByteStringObjOptional(reader.readByteString(fieldNumber));
       break;
     case fieldNumberIdList:
       builder.addElementIdList(reader.readInt(fieldNumber));
       break;
     case fieldNumberNumber2List:
       builder.addElementNumber2List(reader.readLong(fieldNumber));
       break;
     case fieldNumberNameList:
       builder.addElementNameList(reader.readString(fieldNumber));
       break;
     case fieldNumberBoolValList:
       builder.addElementBoolValList(reader.readBoolean(fieldNumber));
       break;
     case fieldNumberAmountList:
       builder.addElementAmountList(reader.readDouble(fieldNumber));
       break;
     case fieldNumberFloatNumList:
       builder.addElementFloatNumList(reader.readFloat(fieldNumber));
       break;
     case fieldNumberByteStringObjList:
       builder.addElementByteStringObjList(reader.readByteString(fieldNumber));
       break;
     default:
       fieldFound = false;
   }
   return fieldFound;
 }