com.google.sitebricks.routing
Class DefaultPageBook

java.lang.Object
  extended by com.google.sitebricks.routing.DefaultPageBook
All Implemented Interfaces:
PageBook

@ThreadSafe
public class DefaultPageBook
extends Object
implements PageBook

contains active uri/widget mappings

Author:
Dhanji R. Prasanna (dhanji@gmail.com)

Nested Class Summary
static class DefaultPageBook.InstanceBoundPage
           
static class DefaultPageBook.PageTuple
           
 
Nested classes/interfaces inherited from interface com.google.sitebricks.routing.PageBook
PageBook.Page, PageBook.Routing
 
Constructor Summary
DefaultPageBook(com.google.inject.Injector injector)
           
 
Method Summary
 DefaultPageBook.PageTuple at(String uri, Class<?> clazz)
          Register a page class at the given contextual URI.
 void at(String uri, List<ActionDescriptor> actionDescriptors, Map<Class<? extends Annotation>,String> methodSet)
           
 PageBook.Page decorate(Class<?> pageClass)
          Indicates that the template for this class is to be inserted into a superclass template using @Decorated
 PageBook.Page embedAs(Class<?> clazz, String as)
          Registers a page class as an embeddable.
 PageBook.Page forClass(Class<?> pageClass)
          Very similar to PageBook.forInstance(Object), except that it takes a class literal instead and does NOT do super crawling.
 PageBook.Page forInstance(Object instance)
          Similar to PageBook.get(java.lang.String) except that instead of returning a page for a URI, it returns the page matching the class of the provided instance, and uses the instance itself to deliver the page.
 PageBook.Page forName(String name)
           
 PageBook.Page get(String uri)
           
 Collection<List<PageBook.Page>> getPageMap()
           
 PageBook.Page nonCompilingGet(String uri)
          Same as PageBook.get(java.lang.String) except guaranteed not to trigger a cascading compile of page bricks.
 PageBook.Page serviceAt(String uri, Class<?> pageClass)
          Same as PageBook.at(java.lang.String, java.lang.Class) but registers a headless web service instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPageBook

@Inject
public DefaultPageBook(com.google.inject.Injector injector)
Method Detail

getPageMap

public Collection<List<PageBook.Page>> getPageMap()
Specified by:
getPageMap in interface PageBook

serviceAt

public PageBook.Page serviceAt(String uri,
                               Class<?> pageClass)
Description copied from interface: PageBook
Same as PageBook.at(java.lang.String, java.lang.Class) but registers a headless web service instead.

Specified by:
serviceAt in interface PageBook

at

public DefaultPageBook.PageTuple at(String uri,
                                    Class<?> clazz)
Description copied from interface: PageBook
Register a page class at the given contextual URI.

Specified by:
at in interface PageBook
Returns:
A PageBook.Page representing the given class without a compiled template applied.

at

public void at(String uri,
               List<ActionDescriptor> actionDescriptors,
               Map<Class<? extends Annotation>,String> methodSet)
Specified by:
at in interface PageBook

embedAs

public PageBook.Page embedAs(Class<?> clazz,
                             String as)
Description copied from interface: PageBook
Registers a page class as an embeddable.

Specified by:
embedAs in interface PageBook
as - The annotation name to register this widget as. Example: "Hello" will make this page class available for embedding as
@Hello
.

decorate

public PageBook.Page decorate(Class<?> pageClass)
Description copied from interface: PageBook
Indicates that the template for this class is to be inserted into a superclass template using @Decorated

Specified by:
decorate in interface PageBook

nonCompilingGet

public PageBook.Page nonCompilingGet(String uri)
Description copied from interface: PageBook
Same as PageBook.get(java.lang.String) except guaranteed not to trigger a cascading compile of page bricks.

Specified by:
nonCompilingGet in interface PageBook

get

@Nullable
public PageBook.Page get(String uri)
Specified by:
get in interface PageBook
Parameters:
uri - A contextual URI where a page (maybe) registered.
Returns:
A PageBook.Page object thatis capable of rend

forName

public PageBook.Page forName(String name)
Specified by:
forName in interface PageBook

forInstance

@Nullable
public PageBook.Page forInstance(Object instance)
Description copied from interface: PageBook
Similar to PageBook.get(java.lang.String) except that instead of returning a page for a URI, it returns the page matching the class of the provided instance, and uses the instance itself to deliver the page.

Specified by:
forInstance in interface PageBook
Parameters:
instance - An instance of some page registered by an @At annotation or similar method in this sitebricks app.

forClass

public PageBook.Page forClass(Class<?> pageClass)
Description copied from interface: PageBook
Very similar to PageBook.forInstance(Object), except that it takes a class literal instead and does NOT do super crawling.

Specified by:
forClass in interface PageBook


Copyright © 2014. All rights reserved.