strangedb/src/main/java/org/warp/jcwdb/ann/exampleimpl/ClassWithList.java

49 lines
1.3 KiB
Java

package org.warp.jcwdb.ann.exampleimpl;
import org.warp.jcwdb.ann.*;
import java.io.IOError;
import java.io.IOException;
import java.util.StringJoiner;
public class ClassWithList extends DBObject {
public ClassWithList(JCWDatabase database) {
super(database);
}
public ClassWithList(JCWDatabase database, DBObjectIndicesManager.DBObjectInfo objectInfo) throws IOException {
super(database, objectInfo);
}
@DBField(id = 0, type = DBDataType.DATABASE_OBJECT)
public DBDBObjectList<IntClass> valueList;
@DBPropertySetter(id = 0, type = DBDataType.DATABASE_OBJECT)
public void setList(DBDBObjectList<IntClass> value) {
setProperty(value);
}
@DBPropertyGetter(id = 0, type = DBDataType.DATABASE_OBJECT)
public DBDBObjectList<IntClass> getList() {
return getProperty();
}
@Override
public String toString() {
DBDBObjectList<IntClass> list;
boolean listErrored = false;
try {
list = getList();
} catch (IOError | Exception ex) {
list = null;
listErrored = true;
}
return new StringJoiner(", ", ClassWithList.class.getSimpleName() + "[", "]")
.add("valueList=" + valueList)
.add("getList=" + (listErrored ? "{error}" : (list == null ? list : list.size() < 100 ? list : "[" + list.size() + " items])")))
.toString();
}
}