Interface IObjectReference
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
IEntityReference
- All Known Implementing Classes:
ObjectReference,UuidEntityRef
public interface IObjectReference extends Serializable
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringgetId()Gets the ID of the identified object.default <T> Optional<T>getId(Function<? super String,? extends T> parser)Parses the identifier using the given parser function.StringgetType()Gets the type of the identified objects.default Optional<EntityType>getTypeKnown()Gets the type as one of the knownentity types.
-
-
-
Method Detail
-
getId
String getId()
Gets the ID of the identified object.- Returns:
- The object ID.
-
getId
default <T> Optional<T> getId(Function<? super String,? extends T> parser)
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
default Optional<EntityType> 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.
-
-