Class HierarchyDecoratorExtensions
- Namespace
- Cuemon.Xml
- Assembly
- Cuemon.Xml.dll
Extension methods for the IHierarchy<T> interface hidden behind the IDecorator<T> interface.
public static class HierarchyDecoratorExtensions
- Inheritance
-
HierarchyDecoratorExtensions
Methods
GetXmlQualifiedEntity(IDecorator<IHierarchy<Object>>, XmlQualifiedEntity)
Resolves an XmlQualifiedEntity from either the specified qualifiedEntity
or from the underlying IHierarchy{object} of the decorator
.
public static XmlQualifiedEntity GetXmlQualifiedEntity(this IDecorator<IHierarchy<object>> decorator, XmlQualifiedEntity qualifiedEntity = null)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
qualifiedEntity
XmlQualifiedEntityThe optional XmlQualifiedEntity that is part of the equation.
Returns
- XmlQualifiedEntity
An XmlQualifiedEntity that is either from
qualifiedEntity
, embedded withindecorator
, XmlRootAttribute, XmlElementAttribute, XmlAttributeAttribute or resolved from either member name or member type (in that order).
Exceptions
- ArgumentNullException
decorator
cannot be null.
HasXmlIgnoreAttribute(IDecorator<IHierarchy<Object>>)
Determines whether the underlying IHierarchy{object} of the decorator
implements XmlIgnoreAttribute.
public static bool HasXmlIgnoreAttribute(this IDecorator<IHierarchy<object>> decorator)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
Returns
- Boolean
true
if the underlying IHierarchy{object} of thedecorator
implements XmlIgnoreAttribute; otherwise,false
.
Exceptions
- ArgumentNullException
decorator
cannot be null.
IsNodeEnumerable(IDecorator<IHierarchy<Object>>)
Determines whether the underlying IHierarchy{object} of the decorator
implements either IEnumerable or IEnumerable<T> and is not a String.
public static bool IsNodeEnumerable(this IDecorator<IHierarchy<object>> decorator)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
Returns
- Boolean
true
if the underlying IHierarchy{object} of thedecorator
implements either IEnumerable or IEnumerable<T> and is not a String; otherwise,false
.
Exceptions
- ArgumentNullException
decorator
cannot be null.
OrderByXmlAttributes<T>(IDecorator<IEnumerable<IHierarchy<T>>>)
Orders a sequence of IHierarchy<T> from the underlying IEnumerable{IHierarchy{object}} of the decorator
by nodes having an XmlAttributeAttribute decoration.
public static IEnumerable<IHierarchy<T>> OrderByXmlAttributes<T>(this IDecorator<IEnumerable<IHierarchy<T>>> decorator)
Parameters
decorator
IDecorator<IEnumerable<IHierarchy<T>>>The IDecorator{IEnumerable{IHierarchy{object}}} to extend.
Returns
- IEnumerable<IHierarchy<T>>
A sequence of IHierarchy<T> that is sorted by nodes having an XmlAttributeAttribute decoration first.
Type Parameters
T
The type of the node represented in the hierarchical structure.
Exceptions
- ArgumentNullException
decorator
cannot be null.
TryGetXmlAttributeAttribute(IDecorator<IHierarchy<Object>>, out XmlAttributeAttribute)
Attempts to get an XmlAttributeAttribute from the underlying IHierarchy{object} of the decorator
.
public static bool TryGetXmlAttributeAttribute(this IDecorator<IHierarchy<object>> decorator, out XmlAttributeAttribute xmlAttribute)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
xmlAttribute
XmlAttributeAttributeWhen this method returns, contains the XmlAttributeAttribute associated with the underlying IHierarchy{object} of the
decorator
.
Returns
- Boolean
true
if underlying IHierarchy{object} of thedecorator
contains an XmlAttributeAttribute,false
otherwise.
TryGetXmlElementAttribute(IDecorator<IHierarchy<Object>>, out XmlElementAttribute)
Attempts to get an XmlElementAttribute from the underlying IHierarchy{object} of the decorator
.
public static bool TryGetXmlElementAttribute(this IDecorator<IHierarchy<object>> decorator, out XmlElementAttribute xmlAttribute)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
xmlAttribute
XmlElementAttributeWhen this method returns, contains the XmlElementAttribute associated with the underlying IHierarchy{object} of the
decorator
.
Returns
- Boolean
true
if underlying IHierarchy{object} of thedecorator
contains an XmlElementAttribute,false
otherwise.
TryGetXmlRootAttribute(IDecorator<IHierarchy<Object>>, out XmlRootAttribute)
Attempts to get an XmlRootAttribute from the underlying IHierarchy{object} of the decorator
.
public static bool TryGetXmlRootAttribute(this IDecorator<IHierarchy<object>> decorator, out XmlRootAttribute xmlAttribute)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
xmlAttribute
XmlRootAttributeWhen this method returns, contains the XmlRootAttribute associated with the underlying IHierarchy{object} of the
decorator
.
Returns
- Boolean
true
if underlying IHierarchy{object} of thedecorator
contains an XmlRootAttribute,false
otherwise.
TryGetXmlTextAttribute(IDecorator<IHierarchy<Object>>, out XmlTextAttribute)
Attempts to get an XmlTextAttribute from the underlying IHierarchy{object} of the decorator
.
public static bool TryGetXmlTextAttribute(this IDecorator<IHierarchy<object>> decorator, out XmlTextAttribute xmlAttribute)
Parameters
decorator
IDecorator<IHierarchy<Object>>The IDecorator{IHierarchy{object}} to extend.
xmlAttribute
XmlTextAttributeWhen this method returns, contains the XmlTextAttribute associated with the underlying IHierarchy{object} of the
decorator
.
Returns
- Boolean
true
if underlying IHierarchy{object} of thedecorator
contains an XmlTextAttribute,false
otherwise.