Method ReflectWith
ReflectWith(IAttributeReflector)
This method is for introspection of attributes, it should simply add the key/values this attribute holds to the given IAttributeReflector.
The default implementation calls Reflect(Type, String, Object) for all non-static fields from the implementing class, using the field name as key and the field value as value. The IAttribute class is also determined by Reflection. Please note that the default implementation can only handle single-Attribute implementations.
Custom implementations look like this (e.g. for a combined attribute implementation):
public void ReflectWith(IAttributeReflector reflector)
{
reflector.Reflect(typeof(ICharTermAttribute), "term", GetTerm());
reflector.Reflect(typeof(IPositionIncrementAttribute), "positionIncrement", GetPositionIncrement());
}
If you implement this method, make sure that for each invocation, the same set of IAttribute
interfaces and keys are passed to Reflect(Type, String, Object) in the same order, but possibly
different values. So don't automatically exclude e.g. null
properties!
Declaration
public virtual void ReflectWith(IAttributeReflector reflector)
Parameters
Type | Name | Description |
---|---|---|
IAttributeReflector | reflector |