You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/09/23 20:41:37 UTC

svn commit: r449285 - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/services/ site/ site/apt/guide/ site/resources/

Author: hlship
Date: Sat Sep 23 11:41:36 2006
New Revision: 449285

URL: http://svn.apache.org/viewvc?view=rev&rev=449285
Log:
Add more documentation about parameter type coercion.

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/coercion.apt
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/CoercionTuple.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.html
    tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.xml
    tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/CoercionTuple.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/CoercionTuple.java?view=diff&rev=449285&r1=449284&r2=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/CoercionTuple.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/CoercionTuple.java Sat Sep 23 11:41:36 2006
@@ -2,7 +2,9 @@
 
 /**
  * An immutable object that represents a mapping from one type to another. This is also the
- * contribution type when buildign the TypeCoercer service.
+ * contribution type when buildign the TypeCoercer service. Wraps a {@link Coercion} object that
+ * performs the work with additional properties that describe the input and output types of the
+ * coercion, needed when searching for an appropriate coercion (or combination of coercions).
  * 
  * @author Howard M. Lewis Ship
  * @param <S>

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/coercion.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/coercion.apt?view=auto&rev=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/coercion.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/coercion.apt Sat Sep 23 11:41:36 2006
@@ -0,0 +1,92 @@
+ ----
+ Parameter Type Coercions
+ ----
+ 
+Parameter Type Coercions
+
+  Tapestry automatically handles type coercions for parameters.
+  
+  Type coercions occur when a value passed into a parameter (as bound in template or
+  in an annoation) does not match the type of the parameter.
+  
+  For example, consider the Loop component:
+  
++---+
+@ComponentClass
+public class Loop
+{
+    @Parameter
+    private int _start = 1;
+
+    @Parameter(required = true)
+    private int _end;
+
+    @Parameter
+    private int _value;
+    
+    . . .
++---+
+
+  Here, the type of all three parameters is int.
+  
+  However, it is likely that the component will be used as so:
+  
++---+
+  Merry Christmas: <t:comp type="Loop" end="3"> Ho! </t:comp>
++---+
+
+  Here the end parameter is bound to the <literal string> "3".
+  
+  Tapestry will automatically coerce the bound value, a string, to the parameter's type, int.
+  
+TypeCoercer Service
+
+  The {{{../apidoc/org/apache/tapestry/services/TypeCoercer.html}tapestry.TypeCoercer}} service
+  is responsible for this type coercion.
+  
+  It is configured with a set of
+  {{{../apidoc/org/apache/tapestry/service/CoercionTuple.html}CoercionTuple}}s.  Each of
+  these tuples defines a source type, a target type, and a bit of code to perform the coersion.
+  
+  An example tuple, to convert from a String to a Double:
+  
++---+
+new CoercionTuple<String,Double>(String.class, Double.class,
+  new Coercer<String,Double>()
+  {
+    public Double coerce(String input)
+    {
+      return new Double(input);
+    }
+  }
+);
++---+
+
+  The service starts with
+  {{{../apidocs/org/apache/tapestry/services/TapestryModule.html#contributeTypeCoercer}a number of coercions}}. The service
+  can infer additional coercions as needed.  The service automatically searches up the inheritance hierarchy to find potential
+  coercions, and can combine existing coercions to create new ones.
+  
+  For example, to coerce an instance of StringBuffer into an Integer, the service will use the Object --> String coercion,
+  then the String --> Double coercion, then the Number --> Integer coercion.
+  
+  As a special case, the service treats null input values as if they were instances of void. This allows tuples
+  for converting nulls:
+  
++---+
+new CoercionTuple<Void,Boolean>(Void.class, Boolean.class,
+  new Coercer<String,Double>()
+  {
+    public Boolean coerce(Void input)
+    {
+      return false;
+    }
+  }
+);
++---+  
+ 
+Contributing New Coercions
+
+  To be documented.
+  
+                
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt?view=diff&rev=449285&r1=449284&r2=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt Sat Sep 23 11:41:36 2006
@@ -96,7 +96,7 @@
   
   Inside the \<comp\> element, the end attribute is used to <bind> the end parameter of the
   Loop component.  Here, it is being bound to the string value "3", which is automatically
-  coerced by Tapestry into the int value, 3.
+  {{{coercion.html}coerced}} by Tapestry into the int value, 3.
     
   Any number of parameters may be bound this way.
   

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.html?view=diff&rev=449285&r1=449284&r2=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.html Sat Sep 23 11:41:36 2006
@@ -5169,15 +5169,15 @@
 <div tiddler="EditTemplate" modifier="HowardLewisShip" modified="200609210649" created="200609210648" tags="">&lt;div class='toolbar' macro='toolbar +saveTiddler -cancelTiddler deleteTiddler'&gt;&lt;/div&gt;\n&lt;div class='title' macro='view title'&gt;&lt;/div&gt;\n&lt;div class='editor' macro='edit title'&gt;&lt;/div&gt;\n&lt;div class='editor' macro='edit text'&gt;&lt;/div&gt;\n&lt;div class='editor' macro='edit tags'&gt;&lt;/div&gt;&lt;div class='editorFooter'&gt;&lt;span macro='message views.editor.tagPrompt'&gt;&lt;/span&gt;&lt;span macro='tagChooser'&gt;&lt;/span&gt;&lt;/div&gt;</div>
 <div tiddler="FormProcessing" modifier="HowardLewisShip" modified="200609211540" created="200609210203" tags="forms">Form processing in Tapestry 4 had certain strengths and limitations.\n\nBasically, any action framework that can do a simple mapping from query parameters to bean property names has advantages in terms of simple forms, and Tapestry 4's approach has huge advantages on more complex forms (with some considerable developer and framework overhead).\n\nWith a direct mapping of query parameter names to bean names, each query parameter becomes self describing. You map query parameters to property of some well known bean. You do simple conversions from strings to other types (typically, ints and dates and the like). You drop query parameters that don't match up. You leave a lot of validation and other plumbing (such as getting those values into your DataTransferObjects) to the developer.\n\nBut you never see a ~StaleLinkException.\n\nYou also have some unwanted loophol
 es in your application in that //any// property can be updated through the URL. This is //one step// towards a security hole.\n\n!Tapestry 4 Approach\n\nEvery form component, as it renders, asks the Form that encloses it to provide a client id.  The terminology is a little messed; client id is the unique (within the form) name for //one rendering// of the component. If the component renders multiple times, because of loops, each rendering gets a unique name.  This becomes the &lt;input&gt;'s name attribute, and ultimately, the query parameter name.\n\nTapestry attempts to make the client id match the (user provided) component id. This is not always possible, especially in a loop, in which case a numeric suffix may be appended to the id to (help) ensure uniqueness.\n\nOn render, a sequence of //component activations// occur, guided by the normal render sequence. The exact sequence of activations guides\nthe production of client ids.\n\nUsing more advanced Tapestry techniques,
  including loops, conditionals and the Block/RenderBlock combo, the exact set of components and\ncomponent activations that will occur for a given rendering of a given form can not be predicted statically. Tapestry must actually render out the form\nto discover all of these.\n\nIn fact, while the Form component is producing this series of client ids, it builds up the list and stores it into the rendered page as a hidden form field. It will need it later, when the client-side form is submitted back to the server.\n\nAn advantage of this approach is the disconnect between the query parameter names (the client ids) and the objects and properties being editted. Often the client ids will be //mneumonic// for the properties, but aren't directly mapped to them. Only the components responsible for each query parameter know how to validate the submitted value, and what property of which object will need to be updated.\n\nWhen a form submission occurs, we want to ensure that each quer
 y parameter value read out of the request is applied to the correct property of the correct object. There's a limit to how much Tapestry can help here (because it has only a casual knowledge of this aspect of the application structure).\n\nDuring this submission process, which endded up with the curious name, //rewind phase//, Tapestry must do two things:\n* Activate each component, such that the component may re-determine its client id, read its parameter, and update its page property\n* Validate that the process has not been comprimised by a change of server side state\n\nThat second element is a tricky one; things can go wonky if a race condition occurs between two users. For example, lets take a simple invoice and line item model. If users A and B both read the same invoice, user A adds a line item, and user B changes a line item ... we can have a problem when user B submits the form. Now that there are three line items (not two) in the form, there will be extra componen
 t activations to process query parameters that don't exist in the request. \n\nThis scenario can occur whenever the processing of the form submission is driven by server-side data that can change between request.\n\nTapestry detects this as a difference in the sequence of client ids allocated, and throws a ~StaleLinkException, which is very frustrating for developers to comprehend and fix.\n\nThere are also other edge cases for different race conditions where data is applied to the wrong server-side objects.\n\nThe Tapestry 3 ~ListEdit component, which evolved into the  Tapestry 4 For component, attempts to address this by serializing a series of //object ids// into the form (as a series of hidden fields). This requires a bit of work on the part of the developer to provide an ~IPrimaryKeyConverter that can help convert objects to ids (when rendering) and ids back to objects (during form submission).\n\nGenerally speaking, the Tapestry 4 approach represents layers of kludge o
 n layers of kludge. It works, it gets the job done, it can handle some very complex situations, but it is less than ideal.\n\n!Tapestry 5\n\nThe goal here is to capture the series of //component activations//, along with any significant page state changes, during the render.\n\nThese activations will be a series of //commands//.  For each component activation there will be two commands:  the first command will be used to inform the component of its client id (this command executes during render and during form submission). The second command will request that the client handle the form submission (this command executes only during form submission).\n\nThe serialized series of commands is stored as a hidden form field.\n\nThere's a lot of API to be figured out, especially the relationship between the form components and the form itself.\n\nFurther, a lot of what the Tapestry 4 For component does, in terms of serializing dynamic page state, will need to fold into this as well.
 \n\nThe end result will be a single hidden field with a big MIME string inside it ... but compared to the Tapestry 4 Form component (which has to write out many hidden fields) the whole will be less than the sum of the parts ... due to the overhead of serialization and gzip compression.\n\n\n\n\n\n\n</div>
 <div tiddler="MainMenu" modifier="HowardLewisShip" modified="200609210701" created="200609210643" tags="">MasterIndex\n[[RSS feed|tap5devwiki.xml]]\n\n[[Tapestry 5 Home|http://tapestry.apache.org/tapestry5/]]\n[[Howard's Blog|http://howardlewisship.com/blog/]]\n\n[[Formatting Help|http://www.blogjones.com/TiddlyWikiTutorial.html#EasyToEdit%20Welcome%20NewFeatures%20WhereToFindHelp]]</div>
-<div tiddler="MasterIndex" modifier="HowardLewisShip" modified="200609211734" created="200609202214" tags="">* PropBindingImprovements -- Desired enhancements to the &quot;prop:&quot; binding\n* TypeCoercion -- How Tapestry 5 will, extensibly, address type conversion\n* FormProcessing\n* DynamicPageState -- tracking changes to page state during the render</div>
+<div tiddler="MasterIndex" modifier="HowardLewisShip" modified="200609231708" created="200609202214" tags="">* PropBindingImprovements -- Desired enhancements to the &quot;prop:&quot; binding\n* TypeCoercion -- How Tapestry 5 extensibly addresses type conversion\n* FormProcessing\n* DynamicPageState -- tracking changes to page state during the render</div>
 <div tiddler="OGNL" modifier="HowardLewisShip" modified="200609202255" created="200609202254" tags="">The [[Object Graph Navigation Library|http://ognl.org]] was an essential part of Tapestry 4.\n\nOGNL is both exceptionally powerful (especially the higher order things it can do, such as list selections and projections). However, for the highest\nend sites, it is also a performance problem, both because of its heavy use of reflection, and because it uses a lot of code inside synchronized blocks.\n\nIt will be optional in Tapestry 5. I believe it will not be part of the tapestry-core, but may be packaged as tapestry-ognl.\n\nThe &quot;prop:&quot; binding prefix is a partial replacement for OGNL in Tapestry 5.  \n\nAs of this writing (Sep 20 2006), the built in support is limited to just simple property names.  At some point in the near future, the PropBindingImprovements will be implemented.</div>
-<div tiddler="PropBindingImprovements" modifier="HowardLewisShip" modified="200609211739" created="200609202203" tags="bindings">&quot;prop:&quot; is going to be the default in a  lot of cases, i.e., in any Java code.\n\nIt should support a lot of common idioms even if they are not, precisely, the names of properties.  In many cases, this will save developers the bother of using a &quot;literal:&quot; prefix.\n\nThe goal of the &quot;prop:&quot; prefix is to be highly efficient and useful in 90%+ of the cases. [[OGNL]], or synthetic properties in the component class, will pick up the remaining cases.\n\n!Numeric literals\n\nSimple numeric literals should be parsed into read-only, invariant bindings.\n{{{\nprop:5\n\nprop:-22.7\n}}}\n\n\nThe resulting objects will be of type Long or type Double. TypeCoercion will ensure that component parameters get values (say, int or float) of the correct type.\n\n!Boolean literals\n\n&quot;true&quot; and &quot;false&quot; should also be con
 verted to invariant bindings.\n{{{\nprop:true\n\nprop:false\n}}}\n\n!String literals\n\n//Simple// string literals, enclosed in single quotes.  Example:\n{{{\nprop:'Hello World'\n}}}\n\n//Remember that the binding expression will always be enclosed in double quotes.//\n\n!This literal\n\nIn some cases, it is useful to be able to identify the current component:\n{{{\nprop:this\n}}}\n\nEven though a component is not immutable, the value of //this// does not ever change,\nand this binding is also invariant.\n\n!Null literal\n\n{{{\nprop:null\n}}}\n\nThis value is always exactly null. This can be used to set a parameter who'se default value is non-null to the explicit value null.\n\n!Property paths\n\nSupporting multi-step property paths should be allowed.  \n{{{\nprop:poll.title\n\nprop:identity.user.name\n}}}\n\nThe initial terms need to be readable, they are never updated. Only the final property name must be read/write, and in fact, it is valid to be read-only or write-only.
 \n\nThe prop: binding factory builds a Java expression to read and update properties. It does not use reflection at runtime. Therefore, the properties of the //declared// type are used. By contrast, [[OGNL]] uses the //actual// type, which is reflection-intensive.\n</div>
+<div tiddler="PropBindingImprovements" modifier="HowardLewisShip" modified="200609231723" created="200609202203" tags="bindings">&quot;prop:&quot; the default in a  lot of cases, i.e., in any Java code.\n\nThis binding prefix  supports several common idioms even though they are not, precisely, the names of properties.  In many cases, this will save developers the bother of using a &quot;literal:&quot; prefix.\n\nThe goal of the &quot;prop:&quot; prefix is to be highly efficient and useful in 90%+ of the cases. [[OGNL]], or synthetic properties in the component class, will pick up the remaining cases.\n\n!Numeric literals\n\nSimple numeric literals should be parsed into read-only, invariant bindings.\n{{{\nprop:5\n\nprop:-22.7\n}}}\n\n\nThe resulting objects will be of type Long or type Double. TypeCoercion will ensure that component parameters get values (say, int or float) of the correct type.\n\n!Boolean literals\n\n&quot;true&quot; and &quot;false&quot; should also be con
 verted to invariant bindings.\n{{{\nprop:true\n\nprop:false\n}}}\n\n!String literals\n\n//Simple// string literals, enclosed in single quotes.  Example:\n{{{\nprop:'Hello World'\n}}}\n\n//Remember that the binding expression will always be enclosed in double quotes.//\n\n!This literal\n\nIn some cases, it is useful to be able to identify the current component:\n{{{\nprop:this\n}}}\n\nEven though a component is not immutable, the value of //this// does not ever change,\nand this binding is also invariant.\n\n!Null literal\n\n{{{\nprop:null\n}}}\n\nThis value is always exactly null. This can be used to set a parameter who'se default value is non-null to the explicit value null.\n\n!Property paths\n\nSupporting multi-step property paths should be allowed.  \n{{{\nprop:poll.title\n\nprop:identity.user.name\n}}}\n\nThe initial terms need to be readable, they are never updated. Only the final property name must be read/write, and in fact, it is valid to be read-only or write-only.
 \n\nThe prop: binding factory builds a Java expression to read and update properties. It does not use reflection at runtime. Therefore, the properties of the //declared// type are used. By contrast, [[OGNL]] uses the //actual// type, which is reflection-intensive.\n\n''(not yet implemented)''\n</div>
 <div tiddler="SideBarTabs" modifier="HowardLewisShip" modified="200609210652" created="200609210651" tags="">&lt;&lt;tabs txtMainTab Timeline Timeline TabTimeline All 'All tiddlers' TabAll Tags 'All tags' TabTags More 'More lists' TabMore&gt;&gt;\n</div>
 <div tiddler="SiteSubtitle" modifier="HowardLewisShip" modified="200609202249" created="200609202155" tags="">\nThe quick and dirty one-stop shopping of random ideas for Tapestry 5.</div>
 <div tiddler="SiteTitle" modifier="HowardLewisShip" modified="200609202249" created="200609202155" tags="">Tapestry 5 Brain Dump</div>
 <div tiddler="SiteUrl" modifier="HowardLewisShip" modified="200609210703" created="200609210641" tags="">http://tapestry.apache.org/tapestry5/tap5devwiki.html</div>
 <div tiddler="TabAll" modifier="HowardLewisShip" modified="200609210650" created="200609210650" tags="">&lt;&lt;list all&gt;&gt;</div>
-<div tiddler="TypeCoercion" modifier="HowardLewisShip" modified="200609211740" created="200609202217" tags="parameters types">Automatic coercion of types is essential.  This primarily applies to component parameters.\n\nParameters are tied to the [[Binding|http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Binding.html]] interface.\n\nTapestry component parameters look like simple instance variables, but Tapestry's RuntimeTransformation of component classes means that reading the value of a parameter instance variable //may// invoke Binding.get(), and changing the value of a parameter instance variable will invoke Binding.set().\n\n!Reading From Parameters\n\nReading a parameter value involves two steps:\n* Invoking Binding.get()\n* Converting the result to the type of the parameter (where different)\n\nWhen reading parameters, the binding will provide an object of the type of the bound property.  Various kinds of invariant bindings will returned a fixed type, 
 typically a String.\n\nThe parameter will be assigned to a variable that has a known type, possibly a primtive type (int, boolean) or an object type (Map, Date).\n\n!Writing To Parameters\n\nWriting to, or updating, a parameter is in two steps:\n* Converting the new value into a type appropriate for the binding\n* Invoking Binding.set()\n\nWe will be adding a getPropertyType() method to the Binding interface, that will identify the property type of the property bound to the parameter.\n\nThe component will be responsible for performing a coercion from the value provided to the proper type, before invoking Binding.set().\n\n!Conversion Tuples\n\nAt the core of this will be a service that performs conversions.\n\nConversions are based on //conversion tuples// that define:\n* A source type\n* A target type\n* An object to perform the conversion from source to target\n* A &quot;cost&quot; for the conversion (possibly, but usually with a standard default value)\n\nAs a special ca
 se, the type of null will be treated as type void (i.e., void.class).  Thus we can use the same mechanism to identify how to convert from null to other types, such as Boolean or Integer.\n\nThere should be a large number of these tuples available.  The most common tuples may be conversions between various types and String.\n\n!Conversion Algorithm\n* Determine the source type (treating null as void.class)\n* Determine the target type (converting primitive types to equivalent wrapper types)\n* If the source type is assignable to the target type, then the input value is valid and the process is complete\n* Find a converter that converts between the source type and the target type, pass the source value through the converter to get a target value\n\nThat last part needs a bit of expansion.\n\nFirst off, there will often ''not'' be a tuple for converting directly form the source type to the target type.\n\nIn that scenario, the conversion will involve a search  to find a sequenc
 e of tuples that will perform the conversion.  This will take the form a breadth-first search where we look for tuples that convert from the source type to an intermediate type, then search for tuples from the intermediate type to the target type.  This may involve more than two conversions.\n\nMay need to express a &quot;cost&quot; of the conversion from start type to target type; this might be useful if there are multiple paths for the conversion. Cost may factor in both the computing expense, and any loss of detail.\n\nFor example, a conversion from Number to Float may be represented as the tuple:\n(Number, Float, {{{ return new Float(input.floatValue()); }}})\n\n{{{\npublic interface TypeConverter&lt;S,T&gt;\n{\n  T convert(S input);\n}\n}}}\n\nIf the input type is an Integer, then a search for Integer-&gt;Float will find no entries. At that point, it will be necessary to &quot;climb&quot; the inheritance tree and look for conversions from Number (the super class of Inte
 ger); this will find the Number-&gt;Float tuple.\n\nAgain, in terms of cost, we might also find a pair of tuples:  Object-&gt;String and String-&gt;Float.  This will have a higher cost than the Number-&gt;Float tuple and should be rejected in favor of the lower cost search.\n\nThis search up the inheritance tree has been [[implemented before|http://jakarta.apache.org/hivemind/hivemind-lib/apidocs/org/apache/hivemind/lib/util/StrategyRegistry.html]].\n\nThe algorithm should certainly cache the result of this search (with concurrent access kept in mind).\n\n!Configuring the service\n\nThis looks like an unordered collection of type ~ConversionTuple.</div>
+<div tiddler="TypeCoercion" modifier="HowardLewisShip" modified="200609231715" created="200609202217" tags="parameters types">Automatic coercion of types is essential.  This primarily applies to component parameters.\n\nParameters are tied to the [[Binding|http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Binding.html]] interface.\n\nTapestry component parameters look like simple instance variables, but Tapestry's RuntimeTransformation of component classes means that reading the value of a parameter instance variable //may// invoke Binding.get(), and changing the value of a parameter instance variable will invoke Binding.set().\n\n!Reading From Parameters\n\nReading a parameter value involves two steps:\n* Invoking Binding.get()\n* Converting the result to the type of the parameter (where different)\n\nWhen reading parameters, the binding will provide an object of the type of the bound property.  Various kinds of invariant bindings will returned a fixed type, 
 typically a String.\n\nThe parameter will be assigned to a variable that has a known type, possibly a primtive type (int, boolean) or an object type (Map, Date).\n\n!Writing To Parameters\n\nWriting to, or updating, a parameter is in two steps:\n* Converting the new value into a type appropriate for the binding\n* Invoking Binding.set()\n\nWe will be adding a getPropertyType() method to the Binding interface, that will identify the property type of the property bound to the parameter.\n\nThe component will be responsible for performing a coercion from the value provided to the proper type, before invoking Binding.set().\n\n!CoercionTuples\n\nAt the core of this will be a service that performs type coercions.\n\nCoercions are based on //coercion tuples// that define:\n* A source type\n* A target type\n* An object to perform the coercion from source to target\n* A &quot;cost&quot; for the conversion (possibly, but usually with a standard default value) ''(not yet implemented)'
 '\n\nAs a special case, the type of null will be treated as type void (i.e., void.class).  Thus we can use the same mechanism to identify how to convert from null to other types, such as Boolean or Integer.\n\nThere should be a large number of these tuples available.  The most common tuples may be conversions between various types and String.\n\n!Coercion Algorithm\n* Determine the source type (treating null as void.class)\n* Determine the target type (converting primitive types to equivalent wrapper types)\n* If the source type is assignable to the target type, then the input value is valid and the process is complete\n* Find a converter that converts between the source type and the target type, pass the source value through the converter to get a target value\n\nThat last part needs a bit of expansion.\n\nFirst off, there will often ''not'' be a tuple for coercing directly form the source type to the target type.\n\nIn that scenario, the conversion will involve a search  t
 o find a sequence of tuples that will perform the coercion.  This will take the form a breadth-first search where we look for tuples that coerce from the source type to an intermediate type, then search for tuples from the intermediate type to the target type.  This may involve more than two coercions.\n\nYou can think of the set of tuples as a kind of directed graph.  Each type is a node on the graph, and each tuple represents a connection between one type and another type (say, from String to Double).  What we're trying to do is find a path form a source type (or some super-class or super-interface of the source type) to some target type (or sub-class or sub-interface of the target type).\n\nMay need to express a &quot;cost&quot; of the coercion from start type to target type; this might be useful if there are multiple paths for the conversion. Cost may factor in both the computing expense, and any loss of detail.  Basic cost is established in terms of the number of steps 
 and enforced by the order in which tuples are considered and combined.\n\nFor example, a coercion tuple from Number to Float may be represented as the tuple:\n(Number, Float, {{{ return new Float(input.floatValue()); }}})\n\n{{{\npublic interface Coercion&lt;S,T&gt;\n{\n  T coerce(S input);\n}\n}}}\n\nIf the input type is an Integer, then a search for Integer-&gt;Float will find no entries. At that point, it will be necessary to &quot;climb&quot; the inheritance tree and look for coercions from Number (the super class of Integer); this will find the Number-&gt;Float tuple.\n\nAgain, in terms of cost, we might also find a pair of tuples:  Object-&gt;String and String-&gt;Float.  This will have a higher cost than the Number-&gt;Float tuple and should be rejected in favor of the lower cost coercion.\n\nThis search up the inheritance tree has been [[implemented before|http://jakarta.apache.org/hivemind/hivemind-lib/apidocs/org/apache/hivemind/lib/util/StrategyRegistry.html]].\n\
 nThe algorithm should certainly cache the result of this search (with concurrent access kept in mind).\n\n!Configuring the service\n\nThis has been implemented as service tapestry.TypeCoercer.\n\nThe configuration of this service is an unordered collection of CoercionTuple.</div>
 		</div>
 <!--POST-BODY-START-->
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.xml?view=diff&rev=449285&r1=449284&r2=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/resources/tap5devwiki.xml Sat Sep 23 11:41:36 2006
@@ -6,30 +6,30 @@
 <description>The quick and dirty one-stop shopping of random ideas for Tapestry 5.</description>
 <language>en-us</language>
 <copyright>Copyright 2006 HowardLewisShip</copyright>
-<pubDate>Thu, 21 Sep 2006 17:40:21 GMT</pubDate>
-<lastBuildDate>Thu, 21 Sep 2006 17:40:21 GMT</lastBuildDate>
+<pubDate>Sat, 23 Sep 2006 17:23:19 GMT</pubDate>
+<lastBuildDate>Sat, 23 Sep 2006 17:23:19 GMT</lastBuildDate>
 <docs>http://blogs.law.harvard.edu/tech/rss</docs>
 <generator>TiddlyWiki 2.0.11</generator>
 <item>
+<title>PropBindingImprovements</title>
+<description>&quot;prop:&quot; the default in a  lot of cases, i.e., in any Java code.&lt;br /&gt;&lt;br /&gt;This binding prefix  supports several common idioms even though they are not, precisely, the names of properties.  In many cases, this will save developers the bother of using a &quot;literal:&quot; prefix.&lt;br /&gt;&lt;br /&gt;The goal of the &quot;prop:&quot; prefix is to be highly efficient and useful in 90%+ of the cases. [[OGNL]], or synthetic properties in the component class, will pick up the remaining cases.&lt;br /&gt;&lt;br /&gt;!Numeric literals&lt;br /&gt;&lt;br /&gt;Simple numeric literals should be parsed into read-only, invariant bindings.&lt;br /&gt;{{{&lt;br /&gt;prop:5&lt;br /&gt;&lt;br /&gt;prop:-22.7&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The resulting objects will be of type Long or type Double. TypeCoercion will ensure that component parameters get values (say, int or float) of the correct type.&lt;br /&gt;&lt;br /&gt;!Boolean liter
 als&lt;br /&gt;&lt;br /&gt;&quot;true&quot; and &quot;false&quot; should also be converted to invariant bindings.&lt;br /&gt;{{{&lt;br /&gt;prop:true&lt;br /&gt;&lt;br /&gt;prop:false&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;!String literals&lt;br /&gt;&lt;br /&gt;//Simple// string literals, enclosed in single quotes.  Example:&lt;br /&gt;{{{&lt;br /&gt;prop:'Hello World'&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;//Remember that the binding expression will always be enclosed in double quotes.//&lt;br /&gt;&lt;br /&gt;!This literal&lt;br /&gt;&lt;br /&gt;In some cases, it is useful to be able to identify the current component:&lt;br /&gt;{{{&lt;br /&gt;prop:this&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;Even though a component is not immutable, the value of //this// does not ever change,&lt;br /&gt;and this binding is also invariant.&lt;br /&gt;&lt;br /&gt;!Null literal&lt;br /&gt;&lt;br /&gt;{{{&lt;br /&gt;prop:null&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;This value is always exactly nul
 l. This can be used to set a parameter who'se default value is non-null to the explicit value null.&lt;br /&gt;&lt;br /&gt;!Property paths&lt;br /&gt;&lt;br /&gt;Supporting multi-step property paths should be allowed.  &lt;br /&gt;{{{&lt;br /&gt;prop:poll.title&lt;br /&gt;&lt;br /&gt;prop:identity.user.name&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;The initial terms need to be readable, they are never updated. Only the final property name must be read/write, and in fact, it is valid to be read-only or write-only.&lt;br /&gt;&lt;br /&gt;The prop: binding factory builds a Java expression to read and update properties. It does not use reflection at runtime. Therefore, the properties of the //declared// type are used. By contrast, [[OGNL]] uses the //actual// type, which is reflection-intensive.&lt;br /&gt;&lt;br /&gt;''(not yet implemented)''&lt;br /&gt;</description>
+<category>bindings</category>
+<link>http://tapestry.apache.org/tapestry5/tap5devwiki.html#PropBindingImprovements</link>
+<pubDate>Sat, 23 Sep 2006 17:23:19 GMT</pubDate>
+</item>
+<item>
 <title>TypeCoercion</title>
-<description>Automatic coercion of types is essential.  This primarily applies to component parameters.&lt;br /&gt;&lt;br /&gt;Parameters are tied to the [[Binding|http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Binding.html]] interface.&lt;br /&gt;&lt;br /&gt;Tapestry component parameters look like simple instance variables, but Tapestry's RuntimeTransformation of component classes means that reading the value of a parameter instance variable //may// invoke Binding.get(), and changing the value of a parameter instance variable will invoke Binding.set().&lt;br /&gt;&lt;br /&gt;!Reading From Parameters&lt;br /&gt;&lt;br /&gt;Reading a parameter value involves two steps:&lt;br /&gt;* Invoking Binding.get()&lt;br /&gt;* Converting the result to the type of the parameter (where different)&lt;br /&gt;&lt;br /&gt;When reading parameters, the binding will provide an object of the type of the bound property.  Various kinds of invariant bindings will returned a fixed
  type, typically a String.&lt;br /&gt;&lt;br /&gt;The parameter will be assigned to a variable that has a known type, possibly a primtive type (int, boolean) or an object type (Map, Date).&lt;br /&gt;&lt;br /&gt;!Writing To Parameters&lt;br /&gt;&lt;br /&gt;Writing to, or updating, a parameter is in two steps:&lt;br /&gt;* Converting the new value into a type appropriate for the binding&lt;br /&gt;* Invoking Binding.set()&lt;br /&gt;&lt;br /&gt;We will be adding a getPropertyType() method to the Binding interface, that will identify the property type of the property bound to the parameter.&lt;br /&gt;&lt;br /&gt;The component will be responsible for performing a coercion from the value provided to the proper type, before invoking Binding.set().&lt;br /&gt;&lt;br /&gt;!Conversion Tuples&lt;br /&gt;&lt;br /&gt;At the core of this will be a service that performs conversions.&lt;br /&gt;&lt;br /&gt;Conversions are based on //conversion tuples// that define:&lt;br /&gt;* A source
  type&lt;br /&gt;* A target type&lt;br /&gt;* An object to perform the conversion from source to target&lt;br /&gt;* A &quot;cost&quot; for the conversion (possibly, but usually with a standard default value)&lt;br /&gt;&lt;br /&gt;As a special case, the type of null will be treated as type void (i.e., void.class).  Thus we can use the same mechanism to identify how to convert from null to other types, such as Boolean or Integer.&lt;br /&gt;&lt;br /&gt;There should be a large number of these tuples available.  The most common tuples may be conversions between various types and String.&lt;br /&gt;&lt;br /&gt;!Conversion Algorithm&lt;br /&gt;* Determine the source type (treating null as void.class)&lt;br /&gt;* Determine the target type (converting primitive types to equivalent wrapper types)&lt;br /&gt;* If the source type is assignable to the target type, then the input value is valid and the process is complete&lt;br /&gt;* Find a converter that converts between the source 
 type and the target type, pass the source value through the converter to get a target value&lt;br /&gt;&lt;br /&gt;That last part needs a bit of expansion.&lt;br /&gt;&lt;br /&gt;First off, there will often ''not'' be a tuple for converting directly form the source type to the target type.&lt;br /&gt;&lt;br /&gt;In that scenario, the conversion will involve a search  to find a sequence of tuples that will perform the conversion.  This will take the form a breadth-first search where we look for tuples that convert from the source type to an intermediate type, then search for tuples from the intermediate type to the target type.  This may involve more than two conversions.&lt;br /&gt;&lt;br /&gt;May need to express a &quot;cost&quot; of the conversion from start type to target type; this might be useful if there are multiple paths for the conversion. Cost may factor in both the computing expense, and any loss of detail.&lt;br /&gt;&lt;br /&gt;For example, a conversion from Num
 ber to Float may be represented as the tuple:&lt;br /&gt;(Number, Float, {{{ return new Float(input.floatValue()); }}})&lt;br /&gt;&lt;br /&gt;{{{&lt;br /&gt;public interface TypeConverter&lt;S,T&gt;&lt;br /&gt;{&lt;br /&gt;  T convert(S input);&lt;br /&gt;}&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;If the input type is an Integer, then a search for Integer-&gt;Float will find no entries. At that point, it will be necessary to &quot;climb&quot; the inheritance tree and look for conversions from Number (the super class of Integer); this will find the Number-&gt;Float tuple.&lt;br /&gt;&lt;br /&gt;Again, in terms of cost, we might also find a pair of tuples:  Object-&gt;String and String-&gt;Float.  This will have a higher cost than the Number-&gt;Float tuple and should be rejected in favor of the lower cost search.&lt;br /&gt;&lt;br /&gt;This search up the inheritance tree has been [[implemented before|http://jakarta.apache.org/hivemind/hivemind-lib/apidocs/org/apache/hivemind/li
 b/util/StrategyRegistry.html]].&lt;br /&gt;&lt;br /&gt;The algorithm should certainly cache the result of this search (with concurrent access kept in mind).&lt;br /&gt;&lt;br /&gt;!Configuring the service&lt;br /&gt;&lt;br /&gt;This looks like an unordered collection of type ~ConversionTuple.</description>
+<description>Automatic coercion of types is essential.  This primarily applies to component parameters.&lt;br /&gt;&lt;br /&gt;Parameters are tied to the [[Binding|http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/Binding.html]] interface.&lt;br /&gt;&lt;br /&gt;Tapestry component parameters look like simple instance variables, but Tapestry's RuntimeTransformation of component classes means that reading the value of a parameter instance variable //may// invoke Binding.get(), and changing the value of a parameter instance variable will invoke Binding.set().&lt;br /&gt;&lt;br /&gt;!Reading From Parameters&lt;br /&gt;&lt;br /&gt;Reading a parameter value involves two steps:&lt;br /&gt;* Invoking Binding.get()&lt;br /&gt;* Converting the result to the type of the parameter (where different)&lt;br /&gt;&lt;br /&gt;When reading parameters, the binding will provide an object of the type of the bound property.  Various kinds of invariant bindings will returned a fixed
  type, typically a String.&lt;br /&gt;&lt;br /&gt;The parameter will be assigned to a variable that has a known type, possibly a primtive type (int, boolean) or an object type (Map, Date).&lt;br /&gt;&lt;br /&gt;!Writing To Parameters&lt;br /&gt;&lt;br /&gt;Writing to, or updating, a parameter is in two steps:&lt;br /&gt;* Converting the new value into a type appropriate for the binding&lt;br /&gt;* Invoking Binding.set()&lt;br /&gt;&lt;br /&gt;We will be adding a getPropertyType() method to the Binding interface, that will identify the property type of the property bound to the parameter.&lt;br /&gt;&lt;br /&gt;The component will be responsible for performing a coercion from the value provided to the proper type, before invoking Binding.set().&lt;br /&gt;&lt;br /&gt;!CoercionTuples&lt;br /&gt;&lt;br /&gt;At the core of this will be a service that performs type coercions.&lt;br /&gt;&lt;br /&gt;Coercions are based on //coercion tuples// that define:&lt;br /&gt;* A source typ
 e&lt;br /&gt;* A target type&lt;br /&gt;* An object to perform the coercion from source to target&lt;br /&gt;* A &quot;cost&quot; for the conversion (possibly, but usually with a standard default value) ''(not yet implemented)''&lt;br /&gt;&lt;br /&gt;As a special case, the type of null will be treated as type void (i.e., void.class).  Thus we can use the same mechanism to identify how to convert from null to other types, such as Boolean or Integer.&lt;br /&gt;&lt;br /&gt;There should be a large number of these tuples available.  The most common tuples may be conversions between various types and String.&lt;br /&gt;&lt;br /&gt;!Coercion Algorithm&lt;br /&gt;* Determine the source type (treating null as void.class)&lt;br /&gt;* Determine the target type (converting primitive types to equivalent wrapper types)&lt;br /&gt;* If the source type is assignable to the target type, then the input value is valid and the process is complete&lt;br /&gt;* Find a converter that converts b
 etween the source type and the target type, pass the source value through the converter to get a target value&lt;br /&gt;&lt;br /&gt;That last part needs a bit of expansion.&lt;br /&gt;&lt;br /&gt;First off, there will often ''not'' be a tuple for coercing directly form the source type to the target type.&lt;br /&gt;&lt;br /&gt;In that scenario, the conversion will involve a search  to find a sequence of tuples that will perform the coercion.  This will take the form a breadth-first search where we look for tuples that coerce from the source type to an intermediate type, then search for tuples from the intermediate type to the target type.  This may involve more than two coercions.&lt;br /&gt;&lt;br /&gt;You can think of the set of tuples as a kind of directed graph.  Each type is a node on the graph, and each tuple represents a connection between one type and another type (say, from String to Double).  What we're trying to do is find a path form a source type (or some super
 -class or super-interface of the source type) to some target type (or sub-class or sub-interface of the target type).&lt;br /&gt;&lt;br /&gt;May need to express a &quot;cost&quot; of the coercion from start type to target type; this might be useful if there are multiple paths for the conversion. Cost may factor in both the computing expense, and any loss of detail.  Basic cost is established in terms of the number of steps and enforced by the order in which tuples are considered and combined.&lt;br /&gt;&lt;br /&gt;For example, a coercion tuple from Number to Float may be represented as the tuple:&lt;br /&gt;(Number, Float, {{{ return new Float(input.floatValue()); }}})&lt;br /&gt;&lt;br /&gt;{{{&lt;br /&gt;public interface Coercion&lt;S,T&gt;&lt;br /&gt;{&lt;br /&gt;  T coerce(S input);&lt;br /&gt;}&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;If the input type is an Integer, then a search for Integer-&gt;Float will find no entries. At that point, it will be necessary to &quot;cli
 mb&quot; the inheritance tree and look for coercions from Number (the super class of Integer); this will find the Number-&gt;Float tuple.&lt;br /&gt;&lt;br /&gt;Again, in terms of cost, we might also find a pair of tuples:  Object-&gt;String and String-&gt;Float.  This will have a higher cost than the Number-&gt;Float tuple and should be rejected in favor of the lower cost coercion.&lt;br /&gt;&lt;br /&gt;This search up the inheritance tree has been [[implemented before|http://jakarta.apache.org/hivemind/hivemind-lib/apidocs/org/apache/hivemind/lib/util/StrategyRegistry.html]].&lt;br /&gt;&lt;br /&gt;The algorithm should certainly cache the result of this search (with concurrent access kept in mind).&lt;br /&gt;&lt;br /&gt;!Configuring the service&lt;br /&gt;&lt;br /&gt;This has been implemented as service tapestry.TypeCoercer.&lt;br /&gt;&lt;br /&gt;The configuration of this service is an unordered collection of CoercionTuple.</description>
 <category>parameters</category>
 <category>types</category>
 <link>http://tapestry.apache.org/tapestry5/tap5devwiki.html#TypeCoercion</link>
-<pubDate>Thu, 21 Sep 2006 17:40:21 GMT</pubDate>
-</item>
-<item>
-<title>PropBindingImprovements</title>
-<description>&quot;prop:&quot; is going to be the default in a  lot of cases, i.e., in any Java code.&lt;br /&gt;&lt;br /&gt;It should support a lot of common idioms even if they are not, precisely, the names of properties.  In many cases, this will save developers the bother of using a &quot;literal:&quot; prefix.&lt;br /&gt;&lt;br /&gt;The goal of the &quot;prop:&quot; prefix is to be highly efficient and useful in 90%+ of the cases. [[OGNL]], or synthetic properties in the component class, will pick up the remaining cases.&lt;br /&gt;&lt;br /&gt;!Numeric literals&lt;br /&gt;&lt;br /&gt;Simple numeric literals should be parsed into read-only, invariant bindings.&lt;br /&gt;{{{&lt;br /&gt;prop:5&lt;br /&gt;&lt;br /&gt;prop:-22.7&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The resulting objects will be of type Long or type Double. TypeCoercion will ensure that component parameters get values (say, int or float) of the correct type.&lt;br /&gt;&lt;br /&gt;!Boolean liter
 als&lt;br /&gt;&lt;br /&gt;&quot;true&quot; and &quot;false&quot; should also be converted to invariant bindings.&lt;br /&gt;{{{&lt;br /&gt;prop:true&lt;br /&gt;&lt;br /&gt;prop:false&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;!String literals&lt;br /&gt;&lt;br /&gt;//Simple// string literals, enclosed in single quotes.  Example:&lt;br /&gt;{{{&lt;br /&gt;prop:'Hello World'&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;//Remember that the binding expression will always be enclosed in double quotes.//&lt;br /&gt;&lt;br /&gt;!This literal&lt;br /&gt;&lt;br /&gt;In some cases, it is useful to be able to identify the current component:&lt;br /&gt;{{{&lt;br /&gt;prop:this&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;Even though a component is not immutable, the value of //this// does not ever change,&lt;br /&gt;and this binding is also invariant.&lt;br /&gt;&lt;br /&gt;!Null literal&lt;br /&gt;&lt;br /&gt;{{{&lt;br /&gt;prop:null&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;This value is always exactly nul
 l. This can be used to set a parameter who'se default value is non-null to the explicit value null.&lt;br /&gt;&lt;br /&gt;!Property paths&lt;br /&gt;&lt;br /&gt;Supporting multi-step property paths should be allowed.  &lt;br /&gt;{{{&lt;br /&gt;prop:poll.title&lt;br /&gt;&lt;br /&gt;prop:identity.user.name&lt;br /&gt;}}}&lt;br /&gt;&lt;br /&gt;The initial terms need to be readable, they are never updated. Only the final property name must be read/write, and in fact, it is valid to be read-only or write-only.&lt;br /&gt;&lt;br /&gt;The prop: binding factory builds a Java expression to read and update properties. It does not use reflection at runtime. Therefore, the properties of the //declared// type are used. By contrast, [[OGNL]] uses the //actual// type, which is reflection-intensive.&lt;br /&gt;</description>
-<category>bindings</category>
-<link>http://tapestry.apache.org/tapestry5/tap5devwiki.html#PropBindingImprovements</link>
-<pubDate>Thu, 21 Sep 2006 17:39:34 GMT</pubDate>
+<pubDate>Sat, 23 Sep 2006 17:15:44 GMT</pubDate>
 </item>
 <item>
 <title>MasterIndex</title>
-<description>* PropBindingImprovements -- Desired enhancements to the &quot;prop:&quot; binding&lt;br /&gt;* TypeCoercion -- How Tapestry 5 will, extensibly, address type conversion&lt;br /&gt;* FormProcessing&lt;br /&gt;* DynamicPageState -- tracking changes to page state during the render</description>
+<description>* PropBindingImprovements -- Desired enhancements to the &quot;prop:&quot; binding&lt;br /&gt;* TypeCoercion -- How Tapestry 5 extensibly addresses type conversion&lt;br /&gt;* FormProcessing&lt;br /&gt;* DynamicPageState -- tracking changes to page state during the render</description>
 <link>http://tapestry.apache.org/tapestry5/tap5devwiki.html#MasterIndex</link>
-<pubDate>Thu, 21 Sep 2006 17:34:20 GMT</pubDate>
+<pubDate>Sat, 23 Sep 2006 17:08:30 GMT</pubDate>
 </item>
 <item>
 <title>DynamicPageState</title>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?view=diff&rev=449285&r1=449284&r2=449285
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Sat Sep 23 11:41:36 2006
@@ -55,6 +55,7 @@
         <menu name="User Guide">
             <item name="Component Classes" href="guide/component-classes.html"/>
             <item name="Component Parameters" href="guide/parameters.html"/>
+            <item name="Type Coercion" href="guide/coercion.html"
             <item name="Component Rendering" href="guide/rendering.html"/>
             <item name="Component Templates" href="guide/templates.html"/>
             <item name="Injection" href="guide/inject.html"/>