title: How to format @param String in Spring Data Rest
body: <p>I have to convert the incoming parameter value to Repository interface into desired format, is it possible to do it. My Domain Class,</p>
  
  <pre><code>@DynamoDBTable(tableName = "test")
  public class Test implements Serializable{
  
      @Id
      private String id;
      private String name;
      private String date;
  
      @DynamoDBHashKey(attributeName = "id")
      @DynamoDBAutoGeneratedKey
      public String getId() {
          return id;
      }
  
      @DynamoDBAttribute(attributeName = "name")
      public String getName() {
          return name;
      }
  
      @DynamoDBAttribute(attributeName = "date")
      @JsonSerialize(using = StringDateSerializer.class)
      public String getDate() {
          return date;
      }
      public void setId(String id) {
          this.id = id;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      @JsonDeserialize(using = StringDateDeserializer.class)
      public void setDate(String date) {
          this.date = date;
      }
  
  }
  </code></pre>
  
  <p>And my repository interface,</p>
  
  <pre><code>@EnableScan
  @RestResource(path="test", rel="test")
  public interface TestRepository extends PagingAndSortingRepository&lt;Test, String&gt;{
  
      @RestResource(path="testsearch", rel="test")
      public Page&lt;Test&gt; findByNameAndDateLessThan(@Param("name") String name, @Param("date") String date, Pageable pageable);
  
  }
  </code></pre>
  
  <p>Here I have to convert the incoming date String to time using getTime() method of Java. Is it possible to achieve this without using controller and am not interested in sending from client side because timezone problem may occur.</p>
  
  <p><strong>My Convertors:</strong></p>
  
  <pre><code>public class StringDateSerializer extends JsonSerializer&lt;String&gt; {
  
      private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
  
      @Override
      public void serialize(String time, JsonGenerator gen,
              SerializerProvider provider) throws IOException,
              JsonProcessingException {
          Date date = new Date(Long.parseLong(time));
          String formattedDate = dateFormat.format(date);
          gen.writeString(formattedDate);
      }
  
  }
  
  public class StringDateDeserializer extends JsonDeserializer&lt;String&gt; {
  
      private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
  
      @Override
      public String deserialize(JsonParser parser, DeserializationContext context)
              throws IOException, JsonProcessingException {
          String dateReceived = parser.getText();
          Date date = null;
          try {
              date = dateFormat.parse(dateReceived);
          } catch (ParseException e) {
              e.printStackTrace();
          }
          return String.valueOf(date.getTime());
      }
  
  }
  </code></pre>
  
  <p><strong>Here I have to use, GET /test/search/test?name=xx&amp;date=14-06-2014. I need to get all the names with date less than 14-06-2014 and left the datas with or after 14-06-2014.</strong></p>
  
  <p>While POST and GET, I have converted the incoming and outgoing string using JsonSerialize and JsonDeserialize annotations but if I want to fetch any data using finder method its not converting as I thought.</p>
  
  <p>For example, If I save {"name": "Test", "date": "08-10-2014"}, in DB it will be saved by its equivalent time and If I want to search it using <strong>08-10-2014</strong> not the time constant. I am new to springs and I cant find a way for it. Thanks in advance.</p>