diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Amenity.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Amenity.java index 54d381e8..9b1c2255 100644 --- a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Amenity.java +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Amenity.java @@ -1,31 +1,5 @@ package org.springframework.webflow.samples.booking; -import java.io.Serializable; - -public class Amenity implements Serializable { - - private String name; - - public Amenity(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Amenity)) { - return false; - } - Amenity a = (Amenity) obj; - return name.equals(a.name); - } - - @Override - public int hashCode() { - return name.hashCode(); - } - -} \ No newline at end of file +public enum Amenity { + OCEAN_VIEW, LATE_CHECKOUT, MINIBAR; +} diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/ApplicationConversionService.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/ApplicationConversionService.java index 00d188ae..b921bf13 100644 --- a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/ApplicationConversionService.java +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/ApplicationConversionService.java @@ -13,7 +13,6 @@ public class ApplicationConversionService extends DefaultConversionService { StringToDate dateConverter = new StringToDate(); dateConverter.setPattern("MM-dd-yyyy"); addConverter("shortDate", dateConverter); - addConverter(new StringToAmenity()); } } \ No newline at end of file diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java index 267ccde4..ecc1db34 100755 --- a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java +++ b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/Booking.java @@ -5,7 +5,6 @@ import java.math.BigDecimal; import java.text.DateFormat; import java.util.Calendar; import java.util.Date; -import java.util.Iterator; import java.util.Set; import javax.persistence.Basic; @@ -187,12 +186,6 @@ public class Booking implements Serializable { } public void setAmenities(Set amenities) { - Iterator it = amenities.iterator(); - while (it.hasNext()) { - Object a = it.next(); - System.out.println(a); - System.out.println(a.getClass()); - } this.amenities = amenities; } diff --git a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/StringToAmenity.java b/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/StringToAmenity.java deleted file mode 100644 index 6c22befc..00000000 --- a/spring-webflow-samples/booking-mvc/src/main/java/org/springframework/webflow/samples/booking/StringToAmenity.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.springframework.webflow.samples.booking; - -import org.springframework.binding.convert.converters.StringToObject; - -public class StringToAmenity extends StringToObject { - - public StringToAmenity() { - super(Amenity.class); - } - - @Override - protected Object toObject(String string, Class tagetClass) throws Exception { - return new Amenity(string); - } - - @Override - protected String toString(Object value) throws Exception { - return ((Amenity) value).getName(); - } - -}