protected virtual IClassMatcher ObtainCustomMatcher(TargetTypeDefinition target)
{
Type customType = target.CustomMatcherType.ResolvedType;
IClassMatcher matcher = GetCustomMatcherFromCache(customType);
try
{
matcher = (IClassMatcher) Activator.CreateInstance(customType);
}
catch (InvalidCastException ex)
{
throw new MatcherException("Error trying to cast your custom class matcher to IClassMatcher", ex);
}
catch (Exception ex)
{
throw new MatcherException("Error trying to instantiate your custom class matcher", ex);
}
RegisterMatcherInCache(matcher, customType);
return matcher;
}