001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.urlencoding; 014 015import org.apache.juneau.*; 016import org.apache.juneau.urlencoding.annotation.*; 017 018/** 019 * Metadata on classes specific to the URL-Encoding serializers and parsers pulled from the {@link UrlEncoding @UrlEncoding} annotation on the class. 020 * 021 * <h5 class='section'>See Also:</h5><ul> 022 * <li class='link'><a class="doclink" href="../../../../index.html#jm.UrlEncodingDetails">URL-Encoding Details</a> 023 * </ul> 024 */ 025public class UrlEncodingClassMeta extends ExtendedClassMeta { 026 027 private final boolean expandedParams; 028 029 /** 030 * Constructor. 031 * 032 * @param cm The class that this annotation is defined on. 033 * @param mp URL-encoding metadata provider (for finding information about other artifacts). 034 */ 035 public UrlEncodingClassMeta(ClassMeta<?> cm, UrlEncodingMetaProvider mp) { 036 super(cm); 037 038 Value<Boolean> expandedParams = Value.empty(); 039 cm.forEachAnnotation(UrlEncoding.class, UrlEncoding::expandedParams, x -> expandedParams.set(true)); 040 this.expandedParams = expandedParams.orElse(false); 041 } 042 043 /** 044 * Returns the {@link UrlEncoding#expandedParams()} annotation defined on the class. 045 * 046 * @return The value of the {@link UrlEncoding#expandedParams()} annotation. 047 */ 048 protected boolean isExpandedParams() { 049 return expandedParams; 050 } 051}