iText 7 7.1.16 API
iText.Kernel.Log.CounterManager Class Reference

Manager that works with ICounterFactory. More...

Public Member Functions

virtual IList< ICounter GetCounters (Type cls)
  Returns a list of registered counters for specific class. More...
 
virtual void  Register (ICounterFactory factory)
  Register new ICounterFactory. More...
 
virtual bool  Unregister (ICounterFactory factory)
  Unregister specified ICounterFactory. More...
 

Static Public Member Functions

static iText.Kernel.Log.CounterManager  GetInstance ()
  Returns the singleton instance of the factory. More...
 

Detailed Description

Manager that works with ICounterFactory.

Manager that works with ICounterFactory . Create ICounter for each registered ICounterFactory and send corresponding events on document read and write.

You can implement your own ICounterFactory and register them with Register(ICounterFactory) Or implement ICounter and register it with SimpleCounterFactory like this: CounterManager.getInstance().register(new SimpleCounterFactory(new SystemOutCounter()); SystemOutCounter is just an example of a ICounter implementation.

This functionality can be used to create metrics in a SaaS context.

Member Function Documentation

◆ GetCounters()

virtual IList<ICounter> iText.Kernel.Log.CounterManager.GetCounters ( Type  cls )
inlinevirtual

Returns a list of registered counters for specific class.

Parameters
cls the class for which registered counters are fetched.
Returns
list of registered ICounter.

◆ GetInstance()

static iText.Kernel.Log.CounterManager iText.Kernel.Log.CounterManager.GetInstance ( )
inlinestatic

Returns the singleton instance of the factory.

Returns
the CounterManager instance.

◆ Register()

virtual void iText.Kernel.Log.CounterManager.Register ( ICounterFactory  factory )
inlinevirtual

Register new ICounterFactory.

Register new ICounterFactory . Does nothing if same factory was already registered.

Parameters
factory

ICounterFactory to be registered

◆ Unregister()

virtual bool iText.Kernel.Log.CounterManager.Unregister ( ICounterFactory  factory )
inlinevirtual

Unregister specified ICounterFactory.

Unregister specified ICounterFactory . Does nothing if this factory wasn't registered first.

Parameters
factory

ICounterFactory to be unregistered

Returns

true if specified factory was registered first