Interface ViewElement
- All Known Subinterfaces:
- ConfigurableTextViewElement,- HtmlViewElement,- MutableViewElement
- All Known Implementing Classes:
- AbstractNodeViewElement,- AbstractTextNodeViewElement,- AbstractVoidNodeViewElement,- ContainerViewElement,- NodeViewElement,- TemplateViewElement,- TextViewElement,- ViewElementGenerator,- ViewElementSupport,- VoidNodeViewElement
public interface ViewElement
Represents a 
ViewElement in its most simple form.  In a web context this is almost certainly
 a HTML node or collection thereof.- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classViewElement.Wither<T extends ViewElement>A wrapper for any type ofViewElementwhich allows the use of separate functions to perform the actions.static interfaceViewElement.WitherGetter<T extends ViewElement,U> Function that fetches a value from a view element and optionally returns it as a specific type for compile time checking.static interfaceViewElement.WitherRemover<T extends ViewElement>Function that modifies a view element by removing values.static interfaceViewElement.WitherSetter<T extends ViewElement>Function that modifies a view element by setting or adding values.
- 
Method SummaryModifier and TypeMethodDescriptiondefault <U> Uget(ViewElement.WitherGetter<?, U> function) Get a value from the element.getName()A ViewElement can have an internal name that identifies it within aContainerViewElement.default booleanCheck if the element matches the predicate given.static <U extends ViewElement>
 Predicate<U>predicateFor(Class<U> elementType, Predicate<U> predicate) Short-hand for creating an anonymous typed predicate, can be used to inline type predicate creation.default ViewElementremove(ViewElement.WitherRemover... functions) Execute one or more remover functions.default ViewElementset(ViewElement.WitherSetter... setters) Execute one or more setter functions.static <U extends ViewElement>
 ViewElement.Wither<U>with(U element) Create aViewElement.Witherwrapper for an element, which allows for a more descriptive, fluent configuration approach by using pre-defined lambdas.
- 
Method Details- 
getNameString getName()A ViewElement can have an internal name that identifies it within aContainerViewElement. A name is optional but when given, is preferably unique within its container as most operations work on the first element with a specific name.- Returns:
- Internal name of this element, can be null.
- See Also:
 
- 
getElementTypeString getElementType()- Returns:
- Type id of this view element.
 
- 
getCustomTemplateString getCustomTemplate()- Returns:
- Custom template to use when rendering this view element.
 
- 
setExecute one or more setter functions.- Parameters:
- setters- to execute
- Returns:
- self
 
- 
removeExecute one or more remover functions. A remover is defined as a separate interface so implementations can both implement setter and remover at the same time.- Parameters:
- functions- to execute
- Returns:
- self
 
- 
matchesCheck if the element matches the predicate given. Note there is no compiler type-safety on this method, predicate implementations should do the type checking. See alsopredicateFor(Class, Predicate)for a helper function to create a typed predicate inline.- Parameters:
- predicate- to test
- Returns:
- predicate outcome
 
- 
getGet a value from the element. UseViewElement.WitherGetter.as(Class)for compile time typing. Note that runtime type casting execptions will occur when using the wrong type.- Type Parameters:
- U- type of the expected return value
- Parameters:
- function- that returns the value
- Returns:
- value
 
- 
withCreate aViewElement.Witherwrapper for an element, which allows for a more descriptive, fluent configuration approach by using pre-defined lambdas.- Type Parameters:
- U- type of the element
- Parameters:
- element- to create a wrapper for
- Returns:
- wither
 
- 
predicateForstatic <U extends ViewElement> Predicate<U> predicateFor(Class<U> elementType, Predicate<U> predicate) Short-hand for creating an anonymous typed predicate, can be used to inline type predicate creation.
 
-