Package com.semanticcms.core.servlet
Class Element<E extends Element>
- java.lang.Object
-
- com.semanticcms.core.servlet.Element<E>
-
- All Implemented Interfaces:
ElementWriter
public abstract class Element<E extends Element> extends Object implements ElementWriter
The base for capturing elements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Element.Body<E extends Element>
static interface
Element.PageContextBody<E extends Element>
static interface
Element.PageContextNoElementBody
-
Field Summary
Fields Modifier and Type Field Description protected E
element
protected HttpServletRequest
request
protected HttpServletResponse
response
protected ServletContext
servletContext
-
Constructor Summary
Constructors Modifier Constructor Description protected
Element(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, E element)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doBody(CaptureLevel captureLevel, Element.Body<? super E> body)
Only called at capture level of META and higher.Element<E>
id(String id)
void
invoke()
void
invoke(Element.Body<? super E> body)
Adds this element to the current page, if part of a page.void
invoke(Element.PageContextBody<? super E> body)
void
invoke(Element.PageContextNoElementBody body)
Element<E>
property(String name, Object value)
Adds a property to the element.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.semanticcms.core.model.ElementWriter
writeTo
-
-
-
-
Field Detail
-
servletContext
protected final ServletContext servletContext
-
request
protected final HttpServletRequest request
-
response
protected final HttpServletResponse response
-
-
Constructor Detail
-
Element
protected Element(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, E element)
-
-
Method Detail
-
property
public Element<E> property(String name, Object value) throws IllegalStateException
Adds a property to the element.- Throws:
IllegalStateException
- if the property with the given name has already been set
-
invoke
public void invoke(Element.Body<? super E> body) throws ServletException, IOException, SkipPageException
Adds this element to the current page, if part of a page. Sets this element as the current element. Then, if not capturing or capturing META or higher, calls
doBody(com.semanticcms.core.servlet.CaptureLevel, com.semanticcms.core.servlet.Element.Body<? super E>)
Also establishes a new
PageContext
.- Throws:
ServletException
IOException
SkipPageException
- See Also:
PageContext
-
invoke
public void invoke() throws ServletException, IOException, SkipPageException
-
invoke
public void invoke(Element.PageContextBody<? super E> body) throws ServletException, IOException, SkipPageException
-
invoke
public void invoke(Element.PageContextNoElementBody body) throws ServletException, IOException, SkipPageException
-
doBody
protected void doBody(CaptureLevel captureLevel, Element.Body<? super E> body) throws ServletException, IOException, SkipPageException
Only called at capture level of META and higher.
-
-