![]() |
Diffusion .NET Classic API - Core and Common
5.9.4
|
This encapsulates all or some of the details of a topic. More...
Public Member Functions | |
TopicDefinition (TopicDataType type) | |
Constructor for creating a topic definition of the specified type. More... | |
TopicDefinition (TopicDataType type, Dictionary< TopicProperty, object > properties) | |
Creates a topic definition of a specified type with properties. More... | |
TopicDefinition (TopicDataType type, IMNode metadata) | |
Creates a topic definition of a specified type with metadata. More... | |
TopicDefinition (TopicDataType type, Dictionary< TopicProperty, object > properties, IMNode metadata) | |
Creates a topic definition. More... | |
void | SetProperty (TopicProperty property, object value) |
Set a topic property. More... | |
void | SetProperty (TopicProperty property, List< string > list) |
Sets a list-type property. More... | |
void | SetListProperty (TopicProperty property, params string[] list) |
Sets a list-type property. More... | |
object | GetProperty (TopicProperty property) |
Returns the value of a topic property. More... | |
string | GetStringProperty (TopicProperty property) |
Returns the value of a property as a string. More... | |
int | GetIntegerProperty (TopicProperty property) |
Returns the value of an integer property. More... | |
long | GetLongProperty (TopicProperty property) |
Returns the value of a long property. More... | |
byte | GetByteProperty (TopicProperty property) |
Returns the value of a byte property. More... | |
bool | GetBooleanProperty (TopicProperty property) |
Returns the value of a boolean property. More... | |
string[] | GetListProperty (TopicProperty property) |
Returns the value of a string property split by list delimiters. More... | |
Dictionary< TopicProperty, object > | GetProperties () |
Returns a copy of the dictionary of the currently-set definition properties. More... | |
void | SetProperties (Dictionary< TopicProperty, object > properties) |
Set properties from a specified dictionary of properties. More... | |
override string | ToString () |
Returns a string representation of this object. More... | |
Properties | |
TopicDataType | Type [get] |
Returns the topic type. More... | |
IMNode | Metadata [get, set] |
Get/set metadata for the topic. More... | |
This encapsulates all or some of the details of a topic.
A topic definition comprises:
This class performs no validation of the settings. If a definition is used to create a topic and mandatory properties (or metadata) are not present, or one or more values are invalid, then topic creation would fail.
Each property has a documented type (e.g. string, integer, long etc.) and the property value may be set to an object of that type, or any other object that can be parsed to that type via its 'ToString' method. For example, to set an integer property you could specify an integer but you could also specify a string with a numeric integer representation within it. However, if a non-numeric value was assigned to an integer property, then a failure may occur when the property is used.
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition | ( | TopicDataType | type | ) |
Constructor for creating a topic definition of the specified type.
For some topic types this may be sufficient, but for other types it may be necessary to set some properties or metadata after construction.
type | The topic type. |
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition | ( | TopicDataType | type, |
Dictionary< TopicProperty, object > | properties | ||
) |
Creates a topic definition of a specified type with properties.
Additional properties can be set after construction if required, as can metadata for those types that need it.
type | The topic type. |
properties | An initial set of properties. |
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition | ( | TopicDataType | type, |
IMNode | metadata | ||
) |
Creates a topic definition of a specified type with metadata.
Properties may still be set after construction if required.
type | The topic type. |
metadata | Topic metadata. The actual type of metadata that is required (if any) would be determined by the topic type. |
PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.TopicDefinition | ( | TopicDataType | type, |
Dictionary< TopicProperty, object > | properties, | ||
IMNode | metadata | ||
) |
Creates a topic definition.
type | The topic type. |
properties | An initial set of properties. Note that properties are optional, but some topic types do have mandatory properties. Additional properties may be set after construction if required. See TopicProperty for full details of available properties. |
metadata | Topic metadata. The actual type of metadata that is required (if any) would be determined by the topic type. |
bool PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetBooleanProperty | ( | TopicProperty | property | ) |
Returns the value of a boolean property.
Note that this will return true only if the property was set to a boolean value, or to an object whose ToString() method returns a value of 'true' regardless of case.
property | The property. |
byte PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetByteProperty | ( | TopicProperty | property | ) |
Returns the value of a byte property.
property | The property value, or null if not defined. |
int PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetIntegerProperty | ( | TopicProperty | property | ) |
Returns the value of an integer property.
property | The property value, or null if not defined. |
string [] PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetListProperty | ( | TopicProperty | property | ) |
Returns the value of a string property split by list delimiters.
property | The property. |
long PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetLongProperty | ( | TopicProperty | property | ) |
Returns the value of a long property.
property | The property value, or null if not defined. |
Dictionary<TopicProperty, object> PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetProperties | ( | ) |
Returns a copy of the dictionary of the currently-set definition properties.
Changing the returned map will not change the definition.
object PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetProperty | ( | TopicProperty | property | ) |
Returns the value of a topic property.
property | The property. |
string PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.GetStringProperty | ( | TopicProperty | property | ) |
Returns the value of a property as a string.
property | The property. |
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetListProperty | ( | TopicProperty | property, |
params string[] | list | ||
) |
Sets a list-type property.
This will set the value of the property as a string with each supplied element separated by a delimiter, suitable for retrieval using GetListProperty( TopicProperty ).
property | The property. |
list | The list of values. |
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperties | ( | Dictionary< TopicProperty, object > | properties | ) |
Set properties from a specified dictionary of properties.
properties | The map of properties to use. |
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperty | ( | TopicProperty | property, |
object | value | ||
) |
Set a topic property.
There are a number of optional properties that may be set for all topic types. Certain topic types have their own additional properties and some of these may be mandatory.
Note that no validation is done on property values and their settings by this method. If the definition is used to create a topic and one or more property values are invalid or missing (if mandatory), then the topic creation would fail.
property | |
value |
void PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.SetProperty | ( | TopicProperty | property, |
List< string > | list | ||
) |
Sets a list-type property.
This will set the value of the property as a string with each supplied element separated by a delimiter, suitable for retrieval using GetListProperty( TopicProperty ).
property | The property. |
list | The list of values. |
override string PushTechnology.DiffusionCore.Messaging.Topic.TopicDefinition.ToString | ( | ) |
Returns a string representation of this object.
|
getset |
Get/set metadata for the topic.
Only some types of topic require metadata. Some other types (with data of type TopicDataWithMetadata) can have optional metadata and for others it would be ignored.
The type of metadata would depend on the topic type as follows:
TopicDataType.SINGLE_VALUE requires metadata of type MField. TopicDataType.RECORD requires metadata of type MMessage. TopicDataType.PAGED_RECORD requires metadata of type MRecord.
And types with optional metadata can take any MNode.
|
get |
Returns the topic type.