Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Property Injector

< To: Tigerstripe Extension Points

  • Full name : org.eclipse.tigerstripe.workbench.base.propertyInjector

Purpose : This extension point is designed to allow users to add specific properties to the context for generation that are not part of the standard set provided by Tigerstipe. This enables some custom behaviour to be layered on top of Tigetstripe. One specific example use case is in the use of maven - If a Tigerstripe model project is "mavenised" and has a pom.xml, then an injector can be used to pass the maven group, artifcat, version properties to the generators whenre they can be accessed in templates, properties etc.

  • Usage :

There are two elements to be provided :

class : The Injector must implement :


injectorTag : This is a string that will be used in the template etcs to reference the injector. (NOTE this is not actually used - the value used is that returned from the implementation!)

Examples on usage :

  1. 1. The "tag" to be used in templates must be set by the Injector (see further below)

@Override public String getTag() { return "maven"; }

  1. 2. It is expected that the Injector implementation will need to access the containing eclipse project (although that is not necessary), and to return values through the public String getProperty(String propname); method. In this snippet the "modl" is imagined to be a maven model that is read when the method public void setTigerstripeProject(TigerstripeProject tsProject); is called.

@Override public String getProperty(String propname) { if (propname.equals("groupId")) { return model.getGroupId(); } if (propname.equals("artifactId")) { return model.getArtifactId(); } if (propname.equals("version")) { return model.getVersion(model); } return null; }

  1. 3. When the Injector is correctly loaded in the runtime, then it can be referenced in one of 3 ways :

A. In a template, using the "Expander" : eg


where "$maven" refers to the name in the "Tag" of teh INjector and "groupId" is one of the matched properties in the getProperty method.

B. In a rule definition : eg the outputFileName


C. As a reference in a Property Default value

The expansion will effectively be the same as for case B above, but abstracted away one level.

Back to the top