package com.hubspot.mesos.json;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class MesosResourcesObject {

  private final int cpus;
  private final long disk;
  private final int mem;
  private final String ports;

  @JsonCreator
  public MesosResourcesObject(@JsonProperty("cpus") int cpus, @JsonProperty("disk") long disk, @JsonProperty("mem") int mem, @JsonProperty("ports") String ports) {
    this.cpus = cpus;
    this.disk = disk;
    this.mem = mem;
    this.ports = ports;
  }

  public int getNumCpus() {
    return cpus;
  }

  public long getDiskSpace() {
    return disk;
  }

  public int getMemoryMegaBytes() {
    return mem;
  }

  public String getPorts() {
    return ports;
  }

}

@@ -37,737 +37,1852 @@
 ort 
-com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.fasterxml.jackson.annotation.JsonProperty;%0A%0Apublic class MesosResourcesObject %7B%0A%0A  private final int cpus;%0A  private final long disk;%0A  private final int mem;%0A  private final String ports;%0A%0A  @JsonCreator%0A  public MesosResourcesObject(@JsonProperty(%22cpus%22) int cpus, @JsonProperty(%22disk%22) long disk, @JsonProperty(%22mem%22) int mem, @JsonProperty(%22ports%22) String ports) %7B%0A    this.cpus = cpus;%0A    this.disk = disk;%0A    this.mem = mem;%0A    this.ports = ports;%0A  %7D%0A%0A  public int getNumCpus() %7B%0A    return cpus;%0A  %7D%0A%0A  public long getDiskSpace() %7B%0A    return disk;%0A  %7D%0A%0A  public int getMemoryMegaBytes() %7B%0A    return mem;%0A  %7D%0A%0A  public String getPorts() %7B%0A    return ports
+static com.google.common.base.Preconditions.checkNotNull;%0A%0Aimport java.util.Map;%0A%0Aimport com.fasterxml.jackson.annotation.JsonCreator;%0Aimport com.google.common.base.Optional;%0Aimport com.google.common.collect.ImmutableMap;%0A%0Apublic class MesosResourcesObject %7B%0A%0A  private final ImmutableMap%3CString, Object%3E properties;%0A%0A  @JsonCreator%0A  public MesosResourcesObject(Map%3CString, Object%3E properties) %7B%0A    this.properties = ImmutableMap.copyOf(checkNotNull(properties, %22properties is null%22));%0A  %7D%0A%0A  public Optional%3CInteger%3E getNumCpus() %7B%0A    return getResourceAsInteger(%22cpu%22);%0A  %7D%0A%0A  public Optional%3CLong%3E getDiskSpace() %7B%0A    return getResourceAsLong(%22disk%22);%0A  %7D%0A%0A  public Optional%3CInteger%3E getMemoryMegaBytes() %7B%0A    return getResourceAsInteger(%22mem%22);%0A  %7D%0A%0A  public Optional%3CString%3E getPorts() %7B%0A    return getResourceAsString(%22ports%22);%0A  %7D%0A%0A  public Optional%3CInteger%3E getResourceAsInteger(String resourceName) %7B%0A    checkNotNull(resourceName, %22resourceName is null%22);%0A    return properties.containsKey(resourceName) ? Optional.of(((Number) properties.get(resourceName)).intValue()) : Optional.%3CInteger%3E absent();%0A  %7D%0A%0A  public Optional%3CLong%3E getResourceAsLong(String resourceName) %7B%0A    checkNotNull(resourceName, %22resourceName is null%22);%0A    return properties.containsKey(resourceName) ? Optional.of(((Number) properties.get(resourceName)).longValue()) : Optional.%3CLong%3E absent();%0A  %7D%0A%0A  public Optional%3CString%3E getResourceAsString(String resourceName) %7B%0A    checkNotNull(resourceName, %22resourceName is null%22);%0A    return properties.containsKey(resourceName) ? Optional.of(properties.get(resourceName).toString()) : Optional.%3CString%3E absent();%0A  %7D%0A%0A  public Optional%3CObject%3E getResourceAsObject(String resourceName) %7B%0A    checkNotNull(resourceName, %22resourceName is null%22);%0A    return Optional.fromNullable(properties.get(resourceName))
 ;%0A  %7D%0A
-%0A
 %7D%0A

Change MesosResourcesObject to be resource agnostic.