Class InsertionHandler

java.lang.Object
com.nomagic.magicreport.engine.velocity.InsertionHandler
All Implemented Interfaces:
IReferenceInsertionHandler

@OpenApiAll public class InsertionHandler extends Object implements IReferenceInsertionHandler
Reference 'Stream insertion' event handler. Called with object that will be inserted into stream by following this logic:
    if (value==null) return reference;
    else return IFormatter.format(Object);
 
Please return an Object that will toString() nicely :)
Since:
Jun 19, 2007
  • Field Details

  • Constructor Details

  • Method Details

    • createFormatter

      protected IFormatter createFormatter(Class<ITemplateEngine> engineClass)
      Deprecated.
      the formatter is no longer determined by Class ITemplateEngine. It will be created directly from ITemplateEngine.getFormatter().
      Determine and create the formatter base on template engine.
      Parameters:
      engineClass - the template engine
      Returns:
      the formatter
    • referenceInsert

      public Object referenceInsert(String reference, Object value, Properties properties)
      A call-back which is executed during Velocity merge before a reference value is inserted into the output stream. All registered ReferenceInsertionEventHandlers are called in sequence. If no ReferenceInsertionEventHandlers are are registered then reference value is inserted into the output stream as is.
      Specified by:
      referenceInsert in interface IReferenceInsertionHandler
      Parameters:
      reference - Reference from template about to be inserted.
      value - Value about to be inserted (after its toString() method is called).
      properties - the engine properties
      Returns:
      Object on which toString() should be called for output.