Annotation Interface Html
HtmlSerializer.
Can be used in the following locations:
- Marshalled classes/methods/fields.
@Rest -annotated classes and@RestOp -annotated methods when anon()value is specified.
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionUse the specified anchor text when serializing a URI.String[]Optional description for the exposed API.Specifies what format to use for the HTML element.Adds a hyperlink to a bean property when rendered as HTML.booleanWhentrue , don't add headers to tables.booleanWhentrue , collections of beans should be rendered as trees instead of tables.String[]Dynamically apply this annotation to the specified classes/methods/fields.Class<?>[]Dynamically apply this annotation to the specified classes.Class<? extends HtmlRender>Associates anHtmlRenderwith a bean property for custom HTML rendering of the property.Specifies the CSS style to apply to the HTML element containing the bean property value.
-
Element Details
-
anchorText
Use the specified anchor text when serializing a URI.The text can contain any bean property values resolved through variables of the form
"{property-name}" .Example:
// Produces <a href='...'>drive</a> when serialized to HTML. @Html (anchorText="drive" )@URI // Treat property as a URL public String getDrive() {...}This overrides the behavior specified by
HtmlSerializer.Builder.uriAnchorText(AnchorText).- Returns:
- The annotation value.
- Default:
- ""
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
format
Specifies what format to use for the HTML element.- Returns:
- The annotation value.
- Default:
- HTML
-
link
Adds a hyperlink to a bean property when rendered as HTML.The text can contain any bean property values resolved through variables of the form
"{property-name}" .The URLs can be any of the following forms:
- Absolute - e.g.
"http://host:123/myContext/myServlet/myPath" - Context-root-relative - e.g.
"/myContext/myServlet/myPath" - Context-relative - e.g.
"context:/myServlet/myPath" - Servlet-relative - e.g.
"servlet:/myPath" - Path-info-relative - e.g.
"myPath"
Example:
public class FileSpace {@Html (link="servlet:/drive/{drive}" )public String getDrive() { ...; } }- Returns:
- The annotation value.
- Default:
- ""
- Absolute - e.g.
-
noTableHeaders
boolean noTableHeaders- Returns:
- The annotation value.
- Default:
- false
-
noTables
boolean noTablesWhentrue , collections of beans should be rendered as trees instead of tables.Default is
false .- Returns:
- The annotation value.
- Default:
- false
-
on
Dynamically apply this annotation to the specified classes/methods/fields.Used in conjunction with
BeanContext.Builder.applyAnnotations(Class...)to dynamically apply an annotation to an existing class/method/field. It is ignored when the annotation is applied directly to classes/methods/fields.Valid patterns:
- Classes:
- Fully qualified:
"com.foo.MyClass"
- Fully qualified inner class:
"com.foo.MyClass$Inner1$Inner2"
- Simple:
"MyClass"
- Simple inner:
"MyClass$Inner1$Inner2" "Inner1$Inner2" "Inner2"
- Fully qualified:
- Methods:
- Fully qualified with args:
"com.foo.MyClass.myMethod(String,int)" "com.foo.MyClass.myMethod(java.lang.String,int)" "com.foo.MyClass.myMethod()"
- Fully qualified:
"com.foo.MyClass.myMethod"
- Simple with args:
"MyClass.myMethod(String,int)" "MyClass.myMethod(java.lang.String,int)" "MyClass.myMethod()"
- Simple:
"MyClass.myMethod"
- Simple inner class:
"MyClass$Inner1$Inner2.myMethod" "Inner1$Inner2.myMethod" "Inner2.myMethod"
- Fully qualified with args:
- Fields:
- Fully qualified:
"com.foo.MyClass.myField"
- Simple:
"MyClass.myField"
- Simple inner class:
"MyClass$Inner1$Inner2.myField" "Inner1$Inner2.myField" "Inner2.myField"
- Fully qualified:
- A comma-delimited list of anything on this list.
See Also:
- Returns:
- The annotation value.
- Default:
- {}
- Classes:
-
onClass
Dynamically apply this annotation to the specified classes.Identical to
on()except allows you to specify class objects instead of a strings.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
render
Class<? extends HtmlRender> renderAssociates anHtmlRenderwith a bean property for custom HTML rendering of the property.This annotation applies to bean properties and classes.
- Returns:
- The annotation value.
- Default:
- org.apache.juneau.html.HtmlRender.class
-
style
Specifies the CSS style to apply to the HTML element containing the bean property value.This is a simpler alternative to using
render()when you only need to apply CSS styling without custom content transformation.Example:
// Apply styling to a bean property @Html (style="white-space:normal;min-width:200px" )public String getField() {...}If both
style()andrender()are specified, the render takes precedence.- Returns:
- The annotation value.
- Default:
- ""
-