OpenTAP 9.24
API Reference
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
OpenTap.AnnotationCollection Class Reference

A collection of annotations. Used to store high-level information about an object. More...

Inherits IEnumerable< IAnnotation >.

Public Member Functions

AnnotationCollection Clone ()
 Creates a new shallow clone of the object. The Annotations list is clone, but the elements are not. More...
 
 AnnotationCollection ()
 
void Add (IAnnotation annotation)
 Adds an annotation. More...
 
void Add (params IAnnotation[] elements)
 adds a list of annotations. More...
 
void AddRange (IEnumerable< IAnnotation > elements)
 adds a list of annotations. More...
 
void RemoveType< T > ()
 Removes all annotations of a specific type from the collection.
 
void Remove (IAnnotation item)
 Removes a specific annotation from the collection.
 
IEnumerator< IAnnotationGetEnumerator ()
 Returns an enumerator that iterates through the collection.
 
Get< T > (bool recursive=false, object from=null)
 Gets the first annotation of a specific kind. Note this goes by the most-recently added principle. More...
 
void Read (object source)
 Updates the annotation based on a source object. More...
 
void Read ()
 Updates the annotation based on that last specified source object.
 
void Write ()
 Writes the annotation data to the last specified source object.
 
void Write (object target)
 Writes the annotation data to a specific source object. More...
 
IEnumerable< T > GetAll< T > (bool recursive=false)
 Gets all the annotations of a specific kind. More...
 
AnnotationCollection AnnotateMember (IMemberData member, object Source, params IAnnotation[] extraAnnotations)
 Annotates a member of the object annotated by this. More...
 
AnnotationCollection AnnotateMember (IMemberData member, params IAnnotation[] extraAnnotations)
 Annotates a member of the object annotated by this. More...
 
AnnotationCollection AnnotateSub (ITypeData reflect, object obj, params IAnnotation[] extraAnnotations)
 Annotates a sub-object of the object annotated by this. More...
 
override string ToString ()
 Creates a string from this. This is useful for debugging. More...
 
void Insert (int index, IAnnotation v)
 Insert an annotation at a location. More...
 

Static Public Member Functions

static AnnotationCollection Create (object @object, IReflectionData member, params IAnnotation[] extraAnnotations)
 Creates a new data annotation. More...
 
static AnnotationCollection Annotate (object @object, params IAnnotation[] extraAnnotations)
 Annotates an object. More...
 

Public Attributes

IAnnotation[] ExtraAnnotations = Array.Empty<IAnnotation>()
 Additional annotations added to the current one.
 

Properties

AnnotationCollection ParentAnnotation [get]
 The annotation that created this annotation.
 
object Source [get]
 The source object currently used for this annotation.
 

Detailed Description

A collection of annotations. Used to store high-level information about an object.

Member Function Documentation

◆ Add() [1/2]

void OpenTap.AnnotationCollection.Add ( IAnnotation  annotation)
inline

Adds an annotation.

Parameters
annotation

◆ Add() [2/2]

void OpenTap.AnnotationCollection.Add ( params IAnnotation[]  elements)
inline

adds a list of annotations.

Parameters
elements

◆ AddRange()

void OpenTap.AnnotationCollection.AddRange ( IEnumerable< IAnnotation elements)
inline

adds a list of annotations.

Parameters
elements

◆ Annotate()

static AnnotationCollection OpenTap.AnnotationCollection.Annotate ( object @  object,
params IAnnotation[]  extraAnnotations 
)
inlinestatic

Annotates an object.

Parameters
object
extraAnnotations
Returns

◆ AnnotateMember() [1/2]

AnnotationCollection OpenTap.AnnotationCollection.AnnotateMember ( IMemberData  member,
object  Source,
params IAnnotation[]  extraAnnotations 
)
inline

Annotates a member of the object annotated by this.

Parameters
member
Source
extraAnnotations
Returns

◆ AnnotateMember() [2/2]

AnnotationCollection OpenTap.AnnotationCollection.AnnotateMember ( IMemberData  member,
params IAnnotation[]  extraAnnotations 
)
inline

Annotates a member of the object annotated by this.

Parameters
member
extraAnnotations
Returns

◆ AnnotateSub()

AnnotationCollection OpenTap.AnnotationCollection.AnnotateSub ( ITypeData  reflect,
object  obj,
params IAnnotation[]  extraAnnotations 
)
inline

Annotates a sub-object of the object annotated by this.

Parameters
reflect
obj
extraAnnotations
Returns

◆ Clone()

AnnotationCollection OpenTap.AnnotationCollection.Clone ( )
inline

Creates a new shallow clone of the object. The Annotations list is clone, but the elements are not.

Returns

◆ Create()

static AnnotationCollection OpenTap.AnnotationCollection.Create ( object @  object,
IReflectionData  member,
params IAnnotation[]  extraAnnotations 
)
inlinestatic

Creates a new data annotation.

Parameters
object
member
extraAnnotations
Returns

◆ Get&lt; T &gt;()

T OpenTap.AnnotationCollection.Get< T > ( bool  recursive = false,
object  from = null 
)
inline

Gets the first annotation of a specific kind. Note this goes by the most-recently added principle.

Template Parameters
TThe kind of annotation to look for.
Parameters
recursiveWhether to include parent annotation search.
fromWhere the search should start.
Returns
Type Constraints
T :IAnnotation 

◆ GetAll&lt; T &gt;()

IEnumerable< T > OpenTap.AnnotationCollection.GetAll< T > ( bool  recursive = false)
inline

Gets all the annotations of a specific kind.

Template Parameters
T
Parameters
recursive
Returns
Type Constraints
T :IAnnotation 

◆ Insert()

void OpenTap.AnnotationCollection.Insert ( int  index,
IAnnotation  v 
)
inline

Insert an annotation at a location.

Parameters
index
v

◆ Read()

void OpenTap.AnnotationCollection.Read ( object  source)
inline

Updates the annotation based on a source object.

Parameters
source

◆ ToString()

override string OpenTap.AnnotationCollection.ToString ( )
inline

Creates a string from this. This is useful for debugging.

Returns

◆ Write()

void OpenTap.AnnotationCollection.Write ( object  target)
inline

Writes the annotation data to a specific source object.

Parameters
target

OpenTAP 9.24 API built Tue Apr 30 2024 13:44:41