java.lang.Object
java.lang.Record
io.jstach.ezkv.kvs.KeyValue.Source
- Record Components:
uri
- the URI representing the origin of the key-value pair.reference
- an optional key-value pair that this one references.index
- an optional index for ordering.
- Enclosing class:
KeyValue
public static record KeyValue.Source(URI uri, @Nullable KeyValue reference, int index)
extends Record
Represents the source information for a
KeyValue
. A Source
can
indicate where the key-value pair was loaded from, such as a configuration file,
system properties, or environment variables. It also supports linking a key-value
pair to another one through the reference
field.
Fields:
uri
- The URI representing the origin of the key-value pair.reference
- An optionalKeyValue
that this key-value depends on (e.g., for chained loading).index
- A numerical identifier that can be used for ordering or tracking.
Usage Example:
The following example demonstrates creating a source from a URI:URI fileUri = URI.create("file:///config.properties");
KeyValue.Source source = new KeyValue.Source(fileUri, null, 0);
System.out.println("Source URI: " + source.uri());
-
Field Summary
Modifier and TypeFieldDescriptionstatic KeyValue.Source
A default, empty source instance used when no specific source information is available.static URI
A constant representing a "null" URI for cases where the source is not specified.static final Pattern
Resource name pattern for validation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
index()
Returns the value of theindex
record component.@Nullable KeyValue
Returns the value of thereference
record component.toString()
Returns a string representation of this record class.uri()
Returns the value of theuri
record component.
-
Field Details
-
NULL_URI
A constant representing a "null" URI for cases where the source is not specified. -
EMPTY
A default, empty source instance used when no specific source information is available. -
RESOURCE_NAME_PATTERN
Resource name pattern for validation.
-
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
uri
Returns the value of theuri
record component.- Returns:
- the value of the
uri
record component
-
reference
Returns the value of thereference
record component.- Returns:
- the value of the
reference
record component
-
index
Returns the value of theindex
record component.- Returns:
- the value of the
index
record component
-