title: jaxb unmarshal timestamp
body: <p>I cannot get JAXB to unmarshal a timestamp in a Resteasy JAX-RS server application.</p>
  
  <p>My class looks like this:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.NONE)
  @XmlRootElement(name = "foo")
  public final class Foo {
      // Other fields omitted
  
      @XmlElement(name = "timestamp", required = true)
      protected Date timestamp;
  
      public Foo() {}
  
      public Date getTimestamp() {
          return timestamp;
      }
  
      public String getTimestampAsString() {
          return (timestamp != null) ? new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timestamp) : null;
      }
  
      public void setTimestamp(final Date timestamp) {
          this.timestamp = timestamp;
      }
  
      public void setTimestamp(final String timestampAsString) {
          try {
              this.timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(timestampAsString);
          } catch (ParseException ex) {
              this.timestamp = null;
          }
      }
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks.</p>