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 aResourceIdrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResourceIdHelper method to create an attribute resource id, where the resource type name will be "attr".static intcomparePair(String lhsNamespace, String lhsName, String rhsNamespace, String rhsName) intCompare strings lexicographically, by namespace, then type, then entry.entry()Returns the value of theentryrecord component.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.Returns the value of thenamespacerecord component.static ResourceIdstatic ResourceIdtoString()Returns a new, single string representation of this resource identifier.static Stringtype()Returns the value of thetyperecord 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:
compareToin interfaceComparable<ResourceId>- Parameters:
o- the object to be compared.
-
comparePair
-
namespace
Returns the value of thenamespacerecord component.- Returns:
- the value of the
namespacerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
entry
Returns the value of theentryrecord component.- Returns:
- the value of the
entryrecord component
-