Refactored some code

This commit is contained in:
Patrick Gotthard 2014-04-13 14:02:03 +02:00
parent 9ff07d3f96
commit 2495106e97
4 changed files with 16 additions and 23 deletions

View file

@ -28,19 +28,16 @@ import com.sun.syndication.feed.impl.ObjectBean;
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class DateValue implements EntryValue {
public class DateValue implements EntryValue<Date> {
private static final long serialVersionUID = 8864338943592633517L;
private Date value;
private final ObjectBean obj = new ObjectBean(DateValue.class, this);
private Date value;
private String element;
private String label;
private Namespace namespace = Namespace.XML_NAMESPACE;
/** Creates a new instance of DateValue */
public DateValue() {
super();
}
/**
*
* @param element
@ -88,7 +85,7 @@ public class DateValue implements EntryValue {
* @return
*/
@Override
public Comparable<Date> getValue() {
public Date getValue() {
return value;
}

View file

@ -26,7 +26,7 @@ import org.jdom2.Namespace;
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public interface EntryValue extends Serializable, Cloneable {
public interface EntryValue<T extends Comparable<T>> extends Serializable, Cloneable {
/**
* Returns the name of the element.
*
@ -46,7 +46,7 @@ public interface EntryValue extends Serializable, Cloneable {
*
* @return Returns the value of the element.
*/
public Comparable<?> getValue();
public T getValue();
/**
* Returns the namespace of the element.

View file

@ -28,18 +28,16 @@ import com.sun.syndication.feed.impl.ObjectBean;
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class NumberValue implements EntryValue {
public class NumberValue implements EntryValue<BigDecimal> {
private static final long serialVersionUID = 8043418996659222922L;
private BigDecimal value;
private final ObjectBean obj = new ObjectBean(NumberValue.class, this);
private BigDecimal value;
private String element;
private String label;
private Namespace namespace = Namespace.XML_NAMESPACE;
/** Creates a new instance of NumberValue */
public NumberValue() {
}
public void setElement(final String element) {
this.element = element;
}
@ -63,7 +61,7 @@ public class NumberValue implements EntryValue {
}
@Override
public Comparable<BigDecimal> getValue() {
public BigDecimal getValue() {
return value;
}

View file

@ -26,18 +26,16 @@ import com.sun.syndication.feed.impl.ObjectBean;
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class StringValue implements EntryValue {
public class StringValue implements EntryValue<String> {
private static final long serialVersionUID = -8384073300710802173L;
private final ObjectBean obj = new ObjectBean(StringValue.class, this);
private String element;
private String label;
private String value;
private Namespace namespace = Namespace.XML_NAMESPACE;
/** Creates a new instance of StringValue */
public StringValue() {
}
public void setElement(final String element) {
this.element = element;
}
@ -61,7 +59,7 @@ public class StringValue implements EntryValue {
}
@Override
public Comparable<String> getValue() {
public String getValue() {
return value;
}