Interface IObjectReference
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
IEntityReference
- All Known Implementing Classes:
ObjectReference, UuidEntityRef
A reference to an object (a concrete instance of a certain type of objects), consisting of the type of the objects
and the unique identifier of the object within that type.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptiongetId()Gets the ID of the identified object.default <T> Optional<T> Parses the identifier using the given parser function.getType()Gets the type of the identified objects.default Optional<EntityType> Gets the type as one of the knownentity types.
-
Method Details
-
getId
-
getId
Parses the identifier using the given parser function. Returns empty when not parseable.- Type Parameters:
T- The type of the parsed identifier.- Parameters:
parser- The parser function, such as a ::valueOf method of some class.- Returns:
- An optional containing the parsed identifier, or an empty optional if parsing failed.
-
getTypeKnown
Gets the type as one of the knownentity types. Returns empty when not parseable.- Returns:
- An optional containing the known type, or an empty optional if parsing failed.
-
getType
String getType()Gets the type of the identified objects. This should be thetype nameof anEntityType, if available, but may be another string in case no such entity type exists. PrefergetTypeKnown()if applicable.- Returns:
- The object type.
-