Pip-Services-Commons-Dotnet
Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | List of all members
PipServices3.Commons.Refer.Descriptor Class Reference

Locator type that most often used in PipServices toolkit. It locates components using several fields: More...

Public Member Functions

 Descriptor (string group, string type, string kind, string name, string version)
 Creates a new instance of the descriptor. More...
 
bool Match (Descriptor descriptor)
 Partially matches this descriptor to another descriptor. Fields that contain "*" or null are excluded from the match. More...
 
bool ExactMatch (Descriptor descriptor)
 Matches this descriptor to another descriptor by all fields. No exceptions are made. More...
 
bool IsComplete ()
 Checks whether all descriptor fields are set. If descriptor has at least one "*" or null field it is considered "incomplete", More...
 
override bool Equals (object obj)
 Compares this descriptor to a value. If value is a Descriptor it tries to match them, otherwise the method returns false. More...
 
override int GetHashCode ()
 
override string ToString ()
 Gets a string representation of the object. The result is a colon-separated list of descriptor fields as "mygroup:connector:aws:default:1.0" More...
 

Static Public Member Functions

static Descriptor FromString (string value)
 Parses colon-separated list of descriptor fields and returns them as a Descriptor. More...
 

Properties

string Group [get, private set]
 
string Type [get, private set]
 
string Kind [get, private set]
 
string Name [get, private set]
 
string Version [get, private set]
 

Private Member Functions

bool MatchField (string field1, string field2)
 
bool ExactMatchField (string field1, string field2)
 

Detailed Description

Locator type that most often used in PipServices toolkit. It locates components using several fields:

The locator matching can be done by all or only few selected fields. The fields that shall be excluded from the matching must be set to "*" or null. That approach allows to implement many interesting scenarios. For instance:

var locator1 = new Descriptor("mygroup", "connector", "aws", "default", "1.0");
var locator2 = Descriptor.fromString("mygroup:connector:*:*:1.0");
locator1.match(locator2); // Result: true
locator1.equal(locator2); // Result: true
locator1.exactMatch(locator2); // Result: false

Constructor & Destructor Documentation

◆ Descriptor()

PipServices3.Commons.Refer.Descriptor.Descriptor ( string  group,
string  type,
string  kind,
string  name,
string  version 
)

Creates a new instance of the descriptor.

Parameters
groupa logical component group
typea logical component type or contract
kinda component implementation type
namea unique component name
versiona component implementation version

Member Function Documentation

◆ Equals()

override bool PipServices3.Commons.Refer.Descriptor.Equals ( object  obj)

Compares this descriptor to a value. If value is a Descriptor it tries to match them, otherwise the method returns false.

Parameters
objthe value to match against this descriptor.
Returns
true if the value is matching descriptor and false otherwise.

◆ ExactMatch()

bool PipServices3.Commons.Refer.Descriptor.ExactMatch ( Descriptor  descriptor)

Matches this descriptor to another descriptor by all fields. No exceptions are made.

Parameters
descriptorthe descriptor to match this one against.
Returns
true if descriptors match and false otherwise.

◆ FromString()

static Descriptor PipServices3.Commons.Refer.Descriptor.FromString ( string  value)
static

Parses colon-separated list of descriptor fields and returns them as a Descriptor.

Parameters
valuecolon-separated descriptor fields to initialize Descriptor.
Returns
a newly created Descriptor.

◆ IsComplete()

bool PipServices3.Commons.Refer.Descriptor.IsComplete ( )

Checks whether all descriptor fields are set. If descriptor has at least one "*" or null field it is considered "incomplete",

Returns
true if all descriptor fields are defined and false otherwise.

◆ Match()

bool PipServices3.Commons.Refer.Descriptor.Match ( Descriptor  descriptor)

Partially matches this descriptor to another descriptor. Fields that contain "*" or null are excluded from the match.

Parameters
descriptorthe descriptor to match this one against.
Returns
true if descriptors match and false otherwise

◆ ToString()

override string PipServices3.Commons.Refer.Descriptor.ToString ( )

Gets a string representation of the object. The result is a colon-separated list of descriptor fields as "mygroup:connector:aws:default:1.0"

Returns
a string representation of the object.

The documentation for this class was generated from the following file: