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 optionalKeyValuethat 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
FieldsModifier and TypeFieldDescriptionstatic KeyValue.SourceA default, empty source instance used when no specific source information is available.static URIA constant representing a "null" URI for cases where the source is not specified.static final PatternResource name pattern for validation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.@Nullable KeyValueReturns the value of thereferencerecord component.toString()Returns a string representation of this record class.uri()Returns the value of theurirecord 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 theurirecord component.- Returns:
- the value of the
urirecord component
-
reference
Returns the value of thereferencerecord component.- Returns:
- the value of the
referencerecord component
-
index
Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-