play.mvc
Interface PathBindable<T extends PathBindable<T>>


public interface PathBindable<T extends PathBindable<T>>

Binder for path parameters. Any type T that implements this class can be bound to/from a path parameter. The only requirement is that the class provides a noarg constructor. For example, the following type could be used to bind an Ebean user:


Method Summary
 T bind(java.lang.String key, java.lang.String txt)
          Bind an URL path parameter.
 java.lang.String javascriptUnbind()
          Javascript function to unbind in the Javascript router.
 java.lang.String unbind(java.lang.String key)
          Unbind a URL path parameter.
 

Method Detail

bind

T bind(java.lang.String key,
       java.lang.String txt)
Bind an URL path parameter.

Parameters:
key - Parameter key
txt - The value as String (extracted from the URL path)
Returns:
The object, may be this object
Throws:
java.lang.RuntimeException - if this object could not be bound

unbind

java.lang.String unbind(java.lang.String key)
Unbind a URL path parameter.

Parameters:
key - Parameter key

javascriptUnbind

java.lang.String javascriptUnbind()
Javascript function to unbind in the Javascript router.

Returns:
The javascript function, or null if you want to use the default implementation.