Package com.itextpdf.text.log
Class CounterFactory
- java.lang.Object
-
- com.itextpdf.text.log.CounterFactory
-
public class CounterFactory extends java.lang.ObjectFactory that creates a counter for every reader or writer class. You can implement your own counter and declare it like this:CounterFactory.getInstance().setCounter(new SysoCounter());SysoCounter is just an example of a Counter implementation. It writes info about files being read and written to the System.out. This functionality can be used to create metrics in a SaaS context.
-
-
Field Summary
Fields Modifier and Type Field Description private CountercounterThe current counter implementation.private static CounterFactorymyselfThe singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description privateCounterFactory()The empty constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CountergetCounter()Getter for the counter.static CountergetCounter(java.lang.Class<?> klass)Returns a counter factory.static CounterFactorygetInstance()Returns the singleton instance of the factory.voidsetCounter(Counter counter)Setter for the counter.
-
-
-
Field Detail
-
myself
private static CounterFactory myself
The singleton instance.
-
counter
private Counter counter
The current counter implementation.
-
-
Method Detail
-
getInstance
public static CounterFactory getInstance()
Returns the singleton instance of the factory.
-
getCounter
public static Counter getCounter(java.lang.Class<?> klass)
Returns a counter factory.
-
getCounter
public Counter getCounter()
Getter for the counter.
-
setCounter
public void setCounter(Counter counter)
Setter for the counter.
-
-