org.jvnet.hyperjaxb3.item.AbstractItemList Maven / Gradle / Ivy
package org.jvnet.hyperjaxb3.item;
import java.io.Serializable;
import java.util.AbstractList;
import java.util.List;
public abstract class AbstractItemList>
extends AbstractList implements ItemList, Serializable {
private static final long serialVersionUID = -6512320214488719797L;
protected final List core;
public AbstractItemList(final List core) {
super();
if (core == null) {
throw new IllegalArgumentException("Core list must be null.");
}
this.core = core;
}
@Override
public ListType get(int index) {
final ItemType item = core.get(index);
return item.getItem();
}
@Override
public ListType set(int index, ListType element) {
final ItemType oldItem = core.get(index);
final ListType oldValue = oldItem.getItem();
oldItem.setItem(element);
return oldValue;
}
@Override
public void add(int index, ListType element) {
final ItemType item = create(element);
core.add(index, item);
}
@Override
public ListType remove(int index) {
final ItemType item = core.remove(index);
return item.getItem();
}
@Override
public int size() {
return core.size();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy