public class FieldOneToMany<T extends NdNode> extends java.lang.Object implements IDestructableField, IRefCountedField, IField
| Modifier and Type | Class and Description |
|---|---|
static interface |
FieldOneToMany.Visitor<T> |
| Modifier and Type | Field and Description |
|---|---|
java.lang.Class<? extends NdNode> |
localType |
java.lang.Class<T> |
targetType |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Nd nd,
long address,
FieldOneToMany.Visitor<T> visitor) |
java.util.List<T> |
asList(Nd nd,
long address) |
static <T extends NdNode,B extends NdNode> |
create(StructDef<B> builder,
FieldManyToOne<B> forwardPointer) |
static <T extends NdNode,B extends NdNode> |
create(StructDef<B> builder,
FieldManyToOne<B> forwardPointer,
int inlineElementCount)
Creates a
FieldOneToMany using the given builder. |
void |
destruct(Nd nd,
long address) |
void |
ensureCapacity(Nd nd,
long address,
int capacity) |
T |
get(Nd nd,
long address,
int index) |
int |
getCapacity(Nd nd,
long address) |
int |
getRecordSize()
Returns the record size of the back pointer list
|
boolean |
hasReferences(Nd nd,
long address)
Returns true if this field knows of any remaining incoming references to this object.
|
boolean |
isEmpty(Nd nd,
long address) |
void |
setOffset(int offset) |
int |
size(Nd nd,
long address) |
public final java.lang.Class<? extends NdNode> localType
public static <T extends NdNode,B extends NdNode> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer, int inlineElementCount)
FieldOneToMany using the given builder. It will hold the many side of a one-to-many
relationship with nodeType.builder - builder that is being used to construct the struct containing this fieldforwardPointer - field of the model object which holds the one side of this one-to-many relationshipinlineElementCount - number of inline elements. If this is nonzero, space for this number elements is
preallocated and reserved in the header. The first few elements inserted will be stored here. For relationships
which will usually have more than a certain number of participants, using a small number of inline elements will
offer a performance improvement. For relationships that will normally be empty, this should be 0.public static <T extends NdNode,B extends NdNode> FieldOneToMany<T> create(StructDef<B> builder, FieldManyToOne<B> forwardPointer)
public void accept(Nd nd, long address, FieldOneToMany.Visitor<T> visitor)
public boolean isEmpty(Nd nd, long address)
public int size(Nd nd, long address)
public int getRecordSize()
getRecordSize in interface IFieldpublic void ensureCapacity(Nd nd, long address, int capacity)
public void destruct(Nd nd, long address)
destruct in interface IDestructableFieldpublic int getCapacity(Nd nd, long address)
public boolean hasReferences(Nd nd, long address)
IRefCountedFieldFieldManyToOne to determine whether or not
a refcounted object should be deleted after a reference is removed.
Implementations should return false if the refcount is 0 or true if the refcount is nonzero.
hasReferences in interface IRefCountedField