Record Class SourceIdentifier
java.lang.Object
java.lang.Record
org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier
- All Implemented Interfaces:
Serializable
,Identifier
,Immutable
public record SourceIdentifier(@NonNull UnresolvedQName.Unqualified name, @Nullable Revision revision)
extends Record
implements Identifier
Base class of YANG Schema source identifiers. Source identifiers are designated to be carry only necessary
information to look up YANG module (or submodule) source and to be used by various SchemaSourceProviders.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSourceIdentifier
(@NonNull String name) Creates new YANG Schema source identifier for sources without a revision.SourceIdentifier
(@NonNull String name, @Nullable String revision) Creates new YANG Schema source identifier for sources with or without a revision.SourceIdentifier
(@NonNull String name, @Nullable Revision revision) Creates new YANG Schema source identifier for sources with or without a revision.SourceIdentifier
(@NonNull UnresolvedQName.Unqualified name) Creates new YANG Schema source identifier for sources without a revision.SourceIdentifier
(@NonNull UnresolvedQName.Unqualified name, @Nullable Revision revision) Creates new YANG Schema source identifier for sources with or without a revision. -
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.@NonNull UnresolvedQName.Unqualified
name()
Returns the value of thename
record component.@Nullable Revision
revision()
Returns the value of therevision
record component.toString()
Returns a string representation of this record class.@NonNull String
Returns filename for this YANG module as specified in RFC 6020.static @NonNull String
toYangFileName
(@NonNull String moduleName, @Nullable Revision revision) Returns filename for this YANG module as specified in RFC 6020.
-
Constructor Details
-
SourceIdentifier
Creates new YANG Schema source identifier for sources with or without a revision.- Parameters:
name
- Name of schemarevision
- Revision of schema- Throws:
NullPointerException
- ifname
is null
-
SourceIdentifier
Creates new YANG Schema source identifier for sources without a revision.- Parameters:
name
- Name of schema- Throws:
NullPointerException
- ifname
is null
-
SourceIdentifier
Creates new YANG Schema source identifier for sources without a revision.- Parameters:
name
- Name of schema- Throws:
NullPointerException
- ifname
is nullIllegalArgumentException
- ifname
is not a valid YANG identifier
-
SourceIdentifier
Creates new YANG Schema source identifier for sources with or without a revision.- Parameters:
name
- Name of schemarevision
- Optional schema revision- Throws:
NullPointerException
- ifname
is nullIllegalArgumentException
- ifname
is not a valid YANG identifier
-
SourceIdentifier
Creates new YANG Schema source identifier for sources with or without a revision.- Parameters:
name
- Name of schemarevision
- Optional schema revision- Throws:
NullPointerException
- ifname
is nullIllegalArgumentException
- ifname
is not a valid YANG identifierDateTimeParseException
- ifrevision
format does not conform specification.
-
-
Method Details
-
toYangFilename
Returns filename for this YANG module as specified in RFC 6020.Returns filename in format
name ['@' revision] '.yang'
, where revision is date in format YYYY-mm-dd.- Returns:
- Filename for this source identifier.
- See Also:
-
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.- Specified by:
toString
in interfaceIdentifier
- Specified by:
toString
in classRecord
- Returns:
- a string representation of this object
-
toYangFileName
public static @NonNull String toYangFileName(@NonNull String moduleName, @Nullable Revision revision) Returns filename for this YANG module as specified in RFC 6020.Returns filename in format
moduleName ['@' revision] '.yang'
, where Where revision-date is in format YYYY-mm-dd.See http://www.rfc-editor.org/rfc/rfc6020#section-5.2
- Parameters:
moduleName
- module namerevision
- optional revision- Returns:
- Filename for this source identifier.
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components.- Specified by:
hashCode
in interfaceIdentifier
- Specified by:
hashCode
in classRecord
- Returns:
- a hash code value for this object
-
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)
.- Specified by:
equals
in interfaceIdentifier
- Specified by:
equals
in classRecord
- Parameters:
o
- the object with which to compare- Returns:
true
if this object is the same as theo
argument;false
otherwise.
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
revision
Returns the value of therevision
record component.- Returns:
- the value of the
revision
record component
-