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

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

// ***************************************************************************************************************************
// * 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.annotation.*;
import org.apache.juneau.html.*;
import org.apache.juneau.serializer.*;

/**
 * Annotation for specifying config properties defined in {@link HtmlSerializer}, {@link HtmlParser}, and {@link HtmlDocSerializer}.
 *
 * 

* Used primarily for specifying bean configuration properties on REST classes and methods. * *

See Also:
*/ @Target({TYPE,METHOD}) @Retention(RUNTIME) @Inherited @ContextApply({HtmlConfigAnnotation.SerializerApply.class,HtmlConfigAnnotation.ParserApply.class}) public @interface HtmlConfig { /** * Optional rank for this config. * *

* Can be used to override default ordering and application of config annotations. * * @return The annotation value. */ int rank() default 0; //------------------------------------------------------------------------------------------------------------------- // HtmlCommon //------------------------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------------------------- // HtmlSerializer //------------------------------------------------------------------------------------------------------------------- /** * Add "_type" properties when needed. * *

* If true, then "_type" properties will be added to beans if their type cannot be inferred * through reflection. * *

* When present, this value overrides the {@link org.apache.juneau.serializer.Serializer.Builder#addBeanTypes()} setting and is * provided to customize the behavior of specific serializers in a {@link SerializerSet}. * *

    *
  • "true" *
  • "false" (default) *
* *
Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#addBeanTypesHtml()} *
* * @return The annotation value. */ String addBeanTypes() default ""; /** * Add key/value headers on bean/map tables. * *

* When enabled, key and value column headers are added to tables. * *

* The following shows the difference between the two generated outputs: * *

* * * * * * * * *
withoutHeaderswithHeaders
* * * *
f1foo
f2bar
*
* * * * *
keyvalue
f1foo
f2bar
*
* *
    *
  • "true" *
  • "false" (default) *
* *
Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#addKeyValueTableHeaders()} *
* * @return The annotation value. */ String addKeyValueTableHeaders() default ""; /** * Don't look for URLs in {@link String Strings}. * *

* Disables the feature where if a string looks like a URL (i.e. starts with "http://" or "https://", then treat it like a URL * and make it into a hyperlink based on the rules specified by {@link org.apache.juneau.html.HtmlSerializer.Builder#uriAnchorText(AnchorText)}. * *

* The following shows the difference between the two generated outputs: * *

* * * * * * * * *
withLinkswithoutLinks
* * * *
keyvalue
f1http://www.apache.org
*
* * * *
keyvalue
f1http://www.apache.org
*
* *
    *
  • "true" *
  • "false" (default) *
* *
Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#disableDetectLinksInStrings()} *
* * @return The annotation value. */ String disableDetectLinksInStrings() default ""; /** * Link label parameter name. * *

* The parameter name to look for when resolving link labels. * *

Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#labelParameter(String)} *
* * @return The annotation value. */ String labelParameter() default ""; /** * Don't look for link labels in URIs. * *

* Disables the feature where if the URL has a label parameter (e.g. "?label=foobar"), then use that as the anchor text of the link. * *

* The parameter name can be changed via the {@link org.apache.juneau.html.HtmlSerializer.Builder#labelParameter(String)} property. * *

* The following shows the difference between the two generated outputs. *
Note that they're both hyperlinks, but the anchor text differs: * *

* * * * * * * * *
withLabelswithoutLabels
* * * *
keyvalue
f1Apache Foundation
*
* * * *
keyvalue
f1http://www.apache.org?label=Apache%20Foundation
*
* *
    *
  • "true" *
  • "false" (default) *
* *
Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#disableDetectLabelParameters()} *
* * @return The annotation value. */ String disableDetectLabelParameters() default ""; /** * Anchor text source. * *

* When creating anchor tags (e.g. <a href='...' * >text</a>) in HTML, this setting defines what to set the inner text to. * *

    *
  • "TO_STRING" - Set to whatever is returned by {@link #toString()} on the object. *
  • "PROPERTY_NAME" - Set to the bean property name. *
  • "URI" - Set to the URI value. *
  • "LAST_TOKEN" - Set to the last token of the URI value. *
  • "URI_ANCHOR" - Set to the anchor of the URL. *
  • "CONTEXT_RELATIVE" - Same as "TO_STRING" but assumes it's a context-relative path. *
  • "SERVLET_RELATIVE" - Same as "TO_STRING" but assumes it's a servlet-relative path. *
  • "PATH_RELATIVE" - Same as "TO_STRING" but assumes it's a path-relative path. *
* *
Notes:
* *
See Also:
    *
  • {@link org.apache.juneau.html.HtmlSerializer.Builder#uriAnchorText(AnchorText)} *
* * @return The annotation value. */ String uriAnchorText() default ""; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy