In my backend view, I have a list of some POJO:
BackingView.java
@Getter @Setter private List<SomePOJO> pojoList = ...
SomePojo.java
@EqualsAndHashCode(callSuper = false, of = {"id"})
public class SomePojo implements Serializable {
private static final long serialVersionUID = 1L;
@Getter @Setter private Long id;
@Getter @Setter private Long date;
@Getter @Setter private Date name;
....
@Override
public String toString() {
return String.format("%s[id=%s]", getClass().getSimpleName(), id);
}
//making a readable string-representation of the object to display on the orderList
public String toStringOrderlistDisplay() {
return "Pojo with id " + id + "and so on... "
}
This list acts as you would expect in all regards. Recently, I wanted to add a feature to my frontend which allows the user to manually order this list. For that purpose I use Primefaces OrderList, like this:
Frontend.xhtml
<p:orderList id="ordList" widgetVar="ordList"
value="#{backingview.pojoList }" var="rfg"
controlsLocation="left" responsive="true" itemValue="#{rfg}"
itemLabel="#{rfg.toStringOrderlistDisplay()}">
</p:orderList>
As soon as I add the above p:orderList to my .xhtml file, I can see when inspecting in debug mode that pojoList
no longer contains instances of PojoClass
but rather plain strings (to be more precise, the string representation of the PojoClass-Object (What the toString() method would return)).
If I simply remove the orderList this problem does not occur. What is going on here? How is such a thing even possible in Java?