All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.juneau.html.annotation.Html Maven / Gradle / Ivy

There is a newer version: 9.0.1
Show newest version
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
// * with the License.  You may obtain a copy of the License at                                                              *
// *                                                                                                                         *
// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
// *                                                                                                                         *
// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
// * specific language governing permissions and limitations under the License.                                              *
// ***************************************************************************************************************************
package org.apache.juneau.html.annotation;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import java.lang.annotation.*;

import org.apache.juneau.html.*;

/**
 * Annotation that can be applied to classes, fields, and methods to tweak how they are handled by {@link HtmlSerializer}.
 */
@Documented
@Target({TYPE,FIELD,METHOD})
@Retention(RUNTIME)
@Inherited
public @interface Html {

	/**
	 * Treat as XML.
	 *
	 * 

* Useful when creating beans that model HTML elements. */ boolean asXml() default false; /** * Treat as plain text. * *

* Object is serialized to a String using the toString() method and written directly to output. * Useful when you want to serialize custom HTML. */ boolean asPlainText() default false; /** * When true, collections of beans should be rendered as trees instead of tables. * *

* Default is false. */ boolean noTables() default false; /** * When true, don't add headers to tables. * *

* Default is false. */ boolean noTableHeaders() default false; /** * Associates an {@link HtmlRender} with a bean property for custom HTML rendering of the property. * *

* This annotation applies to bean properties and classes. */ @SuppressWarnings("rawtypes") Class render() default HtmlRender.class; /** * 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() { * ...; * } * } *

*/ String link() default ""; /** * 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:
*

* public class FileSpace { * * @Html(anchorText="drive/{drive}") * public String getDrive() { * ...; * } * } *

*/ String anchorText() default ""; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy