FrameDescriptor.Builder
public static final class FrameDescriptor.Builder- Inheritance
ObjectBuilder
- Enclosing type
FrameDescriptor
Builder API for frame descriptors with indexed slots.
Methods8
FrameDescriptor.Builder defaultValue(Object)
defaultValue
since 22.0public FrameDescriptor.Builder defaultValue(Object newDefaultValue)Sets the default value for the frame slots in this frame descriptor.
Parameters
newDefaultValueObject- the default value for the resulting frame descriptor
Returns
FrameDescriptor.Builder- No description.
FrameDescriptor.Builder defaultValueIllegal()
defaultValueIllegal
since 24.2public FrameDescriptor.Builder defaultValueIllegal()Sets the default value to illegal, this means that an FrameSlotTypeException is thrown if a slot is read before it is written. A frame descriptor can either have a concrete default value or an illegal default value, but not both.
Returns
FrameDescriptor.Builder- No description.
int addSlots(int, FrameSlotKind)
addSlots
since 22.0public int addSlots(int count, FrameSlotKind kind)Adds the given number of consecutive indexed slots to the FrameDescriptor, and initializes them with the given kind.
Parameters
countint- number of slots to be added
kindFrameSlotKind- default type of the newly added frame slots
Returns
int- index of the first slot
int addSlots(int)
addSlots
since 24.2public int addSlots(int count)Adds the given number of consecutive indexed slots to the FrameDescriptor, and initializes them without a kind. If the kind is read anyway then Illegal will be returned and setting the kind will throw an UnsupportedOperationException.
Parameters
countint- the number of slots to add
Returns
int- No description.
FrameDescriptor.Builder useSlotKinds(boolean)
useSlotKinds
since 24.2public FrameDescriptor.Builder useSlotKinds(boolean b)Enables the use of slot kinds like FrameDescriptor.getSlotKind(int). By default slot kinds are enabled. If they are disabled then FrameDescriptor.getSlotKind(int) always returns FrameSlotKind.Illegal and no slot with a different slot kind than FrameSlotKind.Illegal must be added.
Parameters
bboolean- No description.
Returns
FrameDescriptor.Builder- No description.
int addSlot(FrameSlotKind, Object, Object)
addSlot
since 22.0public int addSlot(FrameSlotKind kind, Object name, Object info)Adds an indexed frame slot to the FrameDescriptor. The frame descriptor's internal arrays for storing name and info are allocated only when needed, so using only null reduces memory footprint.
Parameters
kindFrameSlotKind- default type of the newly added frame slot
nameObject- Name of the newly added frame slot. Can (and should, if possible) be null.
infoObject- Info object for the newly added frame slot. Can (and should, if possible) be null.
Returns
int- No description.
FrameDescriptor.Builder info(Object)
info
since 22.1public FrameDescriptor.Builder info(Object info)Adds a user-defined info object to the frame descriptor. The contents of this object are strongly referenced from the frame descriptor and can be queried using FrameDescriptor.getInfo(). They do not influence the semantics of the frame descriptor in any other way.
Parameters
infoObject- the user-defined info object
Returns
FrameDescriptor.Builder- No description.
FrameDescriptor build()
build
since 22.0public FrameDescriptor build()Uses the data provided to this builder to create a new FrameDescriptor.
Returns
FrameDescriptor- the newly created
FrameDescriptor