All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.psu.swe.scim.spec.protocol.data.StatusAdapter Maven / Gradle / Ivy

There is a newer version: 2.22.4
Show newest version
package edu.psu.swe.scim.spec.protocol.data;

import javax.ws.rs.core.Response.Status;
import javax.xml.bind.annotation.adapters.XmlAdapter;

public class StatusAdapter extends XmlAdapter {

  @Override
  public Status unmarshal(String v) throws Exception {
    if (v == null) {
      return null;
    }

    for (Status status : Status.values()) {
      if (status.getStatusCode() == Integer.valueOf(v)) {
        return status;
      }
    }
    throw new EnumConstantNotPresentException(Status.class, v);
  }

  @Override
  public String marshal(Status v) throws Exception {
    if (v == null) {
      return null;
    }
    return Integer.toString(v.getStatusCode());
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy