001/* 002 * Copyright 2023 the original author or authors. 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.portal.restclient; 017 018import de.cuioss.portal.configuration.types.ConfigAsConnectionMetadata; 019import jakarta.enterprise.util.Nonbinding; 020import jakarta.inject.Qualifier; 021 022import java.lang.annotation.Retention; 023import java.lang.annotation.Target; 024 025import static java.lang.annotation.ElementType.*; 026import static java.lang.annotation.RetentionPolicy.RUNTIME; 027 028/** 029 * <p> 030 * Marker identifying concrete instances of {@link RestClientHolder}. The connection-specific metadata is derived by a number of properties derived by 031 * {@link PortalRestClient#baseName()}. Expected is a structure as defined within {@link ConfigAsConnectionMetadata}. </ p> 032 */ 033@Qualifier 034@Retention(RUNTIME) 035@Target({TYPE, METHOD, FIELD, PARAMETER}) 036public @interface PortalRestClient { 037 038 /** 039 * @return the basename of the configuration, see 040 * {@link ConfigAsConnectionMetadata} for details 041 */ 042 @Nonbinding 043 String baseName(); 044 045 /** 046 * @return boolean indicating whether the corresponding producer should throw an 047 * {@link IllegalArgumentException} in case the properties contain 048 * errors. 049 * Defaults to <code>true</code>. 050 * In case of <code>false</code> 051 * will return the created {@link RestClientHolder} without structural 052 * checks on the configuration 053 */ 054 @Nonbinding 055 boolean failOnInvalidConfiguration() default true; 056}