Record Class CmdInfo
java.lang.Object
java.lang.Record
com.iohao.net.framework.core.CmdInfo
Command routing information composed of a cmd (module) and subCmd (action) pair.
Uses flyweight pattern for instance caching via
CmdInfoFlyweightFactory.- Author:
- 渔民小镇
- date:
- 2021-12-20
-
Constructor Summary
ConstructorsConstructorDescriptionCmdInfo(int cmd, int subCmd, int cmdMerge) Creates an instance of aCmdInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcmd()Returns the value of thecmdrecord component.intcmdMerge()Returns the value of thecmdMergerecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.static CmdInfoof(int cmdMerge) Get or create a CmdInfo from a merged command ID.static CmdInfoof(int cmd, int subCmd) Get or create a CmdInfo for the given cmd and subCmd pair.intsubCmd()Returns the value of thesubCmdrecord component.@NonNull StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CmdInfo
public CmdInfo(int cmd, int subCmd, int cmdMerge) Creates an instance of aCmdInforecord class.- Parameters:
cmd- the value for thecmdrecord componentsubCmd- the value for thesubCmdrecord componentcmdMerge- the value for thecmdMergerecord component
-
-
Method Details
-
of
Get or create a CmdInfo for the given cmd and subCmd pair.- Parameters:
cmd- the module-level command IDsubCmd- the action-level sub-command ID- Returns:
- a cached or newly created
CmdInfoinstance
-
of
Get or create a CmdInfo from a merged command ID.- Parameters:
cmdMerge- the merged command ID encoding both cmd and subCmd- Returns:
- a cached or newly created
CmdInfoinstance
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
hashCode
-
toString
-
cmd
public int cmd()Returns the value of thecmdrecord component.- Returns:
- the value of the
cmdrecord component
-
subCmd
public int subCmd()Returns the value of thesubCmdrecord component.- Returns:
- the value of the
subCmdrecord component
-
cmdMerge
public int cmdMerge()Returns the value of thecmdMergerecord component.- Returns:
- the value of the
cmdMergerecord component
-