com.xlrit.gears.base.collection.CollectionRefFromRelation Maven / Gradle / Ivy
package com.xlrit.gears.base.collection;
import java.util.List;
import com.xlrit.gears.base.meta.Relation;
public class CollectionRefFromRelation implements CollectionRef {
private final O owner;
private final Relation.ToMany relation;
public CollectionRefFromRelation(O owner, Relation.ToMany relation) {
this.owner = owner;
this.relation = relation;
}
@Override
public Class getElementType() {
return relation.getElementType();
}
public List getElements() {
return relation.get(owner);
}
public void updateElements(List newElements) {
relation.set(owner, newElements);
}
}