Package dev.gmitch215.bytebox.io
Record Class SerialDescriptor
java.lang.Object
java.lang.Record
dev.gmitch215.bytebox.io.SerialDescriptor
- Record Components:
className- the binary name, with dots and a$before a nested class's nameserialVersionUID- the declared value, or the one computed from the class's shapeflags- the descriptor flags:0x02for serializable, plus0x10for an enumfields- the fields this level declares, primitives first and then references, each group in alphabetical order, which is the order the format fixes
public record SerialDescriptor(String className, long serialVersionUID, byte flags, List<SerialField> fields)
extends Record
One class's entry in a stream's class descriptor chain.
A stream describes the whole hierarchy, not just the class being written, because a reader has to
know which fields belong to which level. SerialCodec.descriptors() carries the chain.
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteAn enum class, whose constants are written by name.static final SerialDescriptorThe descriptor every enum's chain ends with.static final byteA class that takes part in serialization. -
Constructor Summary
ConstructorsConstructorDescriptionSerialDescriptor(String className, long serialVersionUID, byte flags, List<SerialField> fields) Creates an instance of aSerialDescriptorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassNamerecord component.final booleanIndicates whether some other object is "equal to" this one.fields()Returns the value of thefieldsrecord component.byteflags()Returns the value of theflagsrecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of theserialVersionUIDrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
SERIALIZABLE
public static final byte SERIALIZABLEA class that takes part in serialization.- See Also:
-
ENUM
public static final byte ENUMAn enum class, whose constants are written by name.- See Also:
-
JAVA_LANG_ENUM
The descriptor every enum's chain ends with.Written by generated code, so it is here rather than kept private: a wrong copy of it would produce a stream a JVM misreads, and
SerialConformanceTestchecks this one.
-
-
Constructor Details
-
SerialDescriptor
public SerialDescriptor(String className, long serialVersionUID, byte flags, List<SerialField> fields) Creates an instance of aSerialDescriptorrecord class.- Parameters:
className- the value for theclassNamerecord componentserialVersionUID- the value for theserialVersionUIDrecord componentflags- the value for theflagsrecord componentfields- the value for thefieldsrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
className
Returns the value of theclassNamerecord component.- Returns:
- the value of the
classNamerecord component
-
serialVersionUID
public long serialVersionUID()Returns the value of theserialVersionUIDrecord component.- Returns:
- the value of the
serialVersionUIDrecord component
-
flags
public byte flags()Returns the value of theflagsrecord component.- Returns:
- the value of the
flagsrecord component
-
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-