mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
* no effective code change: add missing @override in "io.ebean.*" package * no effective code change: add missing @override in "io.ebeaninternal.api.*" package * no effective code change: add missing @override in "io.ebeaninternal.server.*" package * no effective code change: add missing @override in "io.ebeaninternal.util.*" package * no effective code change: add missing @override in "io.ebeanservice.*" package * no effective code change: add missing @override in "src/test/java/"
57 lines
1.1 KiB
Java
57 lines
1.1 KiB
Java
package io.ebeaninternal.server.cache;
|
|
|
|
import java.io.Externalizable;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInput;
|
|
import java.io.ObjectOutput;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* The cached data for O2M and M2M relationships.
|
|
* <p>
|
|
* This is effectively just the Id values for each of the beans in the collection.
|
|
* </p>
|
|
*/
|
|
public class CachedManyIds implements Externalizable {
|
|
|
|
private List<Object> idList;
|
|
|
|
public CachedManyIds(List<Object> idList) {
|
|
this.idList = idList;
|
|
}
|
|
|
|
/**
|
|
* Construct for serialization.
|
|
*/
|
|
public CachedManyIds() {
|
|
}
|
|
|
|
@Override
|
|
public void writeExternal(ObjectOutput out) throws IOException {
|
|
out.writeInt(idList.size());
|
|
for (Object id : idList) {
|
|
out.writeObject(id);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
|
|
int size = in.readInt();
|
|
idList = new ArrayList<>(size);
|
|
for (int i = 0; i < size; i++) {
|
|
idList.add(in.readObject());
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return idList.toString();
|
|
}
|
|
|
|
public List<Object> getIdList() {
|
|
return idList;
|
|
}
|
|
|
|
}
|