Class ModelHelper
Denotes helper methods for model elements
public static class ModelHelper
- Inheritance
-
ModelHelper
- Inherited Members
Methods
CanCreateInstance<T>()
True, if an instance of the element type can be created automatically, resolving DefaultImplementationType attributes
public static bool CanCreateInstance<T>()
Returns
- bool
True, if an element of the given type can be instantiated, otherwise False
Type Parameters
T
The type of elements to create
CreateInstance<T>()
Creates an instance of the given element type
public static T CreateInstance<T>()
Returns
- T
Type Parameters
T
CreatePath(string)
Creates a relative Uri for the given reference name
public static string CreatePath(string reference)
Parameters
reference
stringThe name of the reference
Returns
- string
A relative Uri for the given reference
CreatePath(string, int)
Creates a Uri for an ordered reference where the child element has the given index
public static string CreatePath(string reference, int index)
Parameters
Returns
- string
A relative Uri for the reference with the given index
ImplementationType<T>()
Gets the type used to instantiate the given type
public static Type ImplementationType<T>()
Returns
- Type
The type used for the implementation
Type Parameters
T
The interface type in question
IndexOfReference<T>(IList<T>, IModelElement)
Gets the index of the given element inside the given reference or -1 if the element is not contained in the reference
public static int IndexOfReference<T>(IList<T> reference, IModelElement element) where T : class, IModelElement
Parameters
reference
IList<T>The reference list
element
IModelElementThe element that should be looked for
Returns
- int
The index of the element or -1, if the reference does not contain the given element
Type Parameters
T
The element type for the reference
ParseIdentifierSegment(string, out string, out string, out string)
Parses the given relative Uri for a identifier reference
public static bool ParseIdentifierSegment(string segment, out string reference, out string identifierReference, out string identifier)
Parameters
segment
stringThe relative Uri
reference
stringThe reference that corresponds to the Uri. This is never null.
identifierReference
stringThe identifier reference. This is never null.
identifier
stringThe identifier. This is never null.
Returns
- bool
True, if the segment was parsed successfully, otherwise false
ParseSegment(string, out string, out int)
Parses the given relative Uri
public static bool ParseSegment(string segment, out string reference, out int index)
Parameters
segment
stringthe relative Uri
reference
stringThe reference that corresponds to the Uri. This is never null.
index
intThe element index of the Uri or 0 if no index is given
Returns
- bool
True, if the segment was parsed successfully, otherwise false
Parse<T>(string)
Parses the given text into the given type
public static T Parse<T>(string text)
Parameters
text
stringThe text that should be parsed
Returns
- T
An instance of the semantic type
Type Parameters
T
The type of element