Package icyllis.modernui.resources
Record Class ResourceId
java.lang.Object
java.lang.Record
icyllis.modernui.resources.ResourceId
- Record Components:
namespace
- the domain of resourcetype
- the class of resourceentry
- the name of resource entry
- All Implemented Interfaces:
Comparable<ResourceId>
@Immutable
public record ResourceId(String namespace, String type, String entry)
extends Record
implements Comparable<ResourceId>
A resource identifier. This can uniquely identify a resource in the ResourceTable.
A resource identifier consists of three parts: namespace, type, and entry. Its single string representation is "namespace:type/entry" or "type/entry" (if namespace is empty). For a valid resource identifier, type and entry can not be empty.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceId
(String namespace, String type, String entry) Creates an instance of aResourceId
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceId
Helper method to create an attribute resource id, where the resource type name will be "attr".static int
comparePair
(String lhsNamespace, String lhsName, String rhsNamespace, String rhsName) int
Compare strings lexicographically, by namespace, then type, then entry.entry()
Returns the value of theentry
record component.boolean
Indicates whether some other object is "equal to" this one.int
hashCode()
Returns a hash code value for this object.Returns the value of thenamespace
record component.static ResourceId
static ResourceId
toString()
Returns a new, single string representation of this resource identifier.static String
type()
Returns the value of thetype
record component.
-
Constructor Details
-
Method Details
-
parse
-
parse
-
attr
@NonNull @Contract("_, _ -> new") public static ResourceId attr(@NonNull String namespace, @NonNull String name) Helper method to create an attribute resource id, where the resource type name will be "attr". -
toString
Returns a new, single string representation of this resource identifier. -
toString
-
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 withObjects::equals(Object,Object)
. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
compareTo
Compare strings lexicographically, by namespace, then type, then entry.- Specified by:
compareTo
in interfaceComparable<ResourceId>
- Parameters:
o
- the object to be compared.
-
comparePair
-
namespace
Returns the value of thenamespace
record component.- Returns:
- the value of the
namespace
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
entry
Returns the value of theentry
record component.- Returns:
- the value of the
entry
record component
-