001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 */ 011package org.apache.juneau.commons.inject; 012 013import static java.lang.annotation.ElementType.*; 014import static java.lang.annotation.RetentionPolicy.*; 015 016import java.lang.annotation.*; 017 018/** 019 * Condition that checks a setting value. 020 */ 021@Documented 022@Target({TYPE, METHOD, FIELD}) 023@Retention(RUNTIME) 024@Repeatable(ConditionalOnProperties.class) 025public @interface ConditionalOnProperty { 026 027 /** 028 * The property name to look up. 029 * 030 * @return The property name. 031 */ 032 String name(); 033 034 /** 035 * Required property value. 036 * 037 * <p> 038 * When blank, any present value matches. 039 * 040 * @return The required value. 041 */ 042 String havingValue() default ""; 043 044 /** 045 * Whether to match when the property is missing. 046 * 047 * @return <jk>true</jk> to match missing properties. 048 */ 049 boolean matchIfMissing() default false; 050} 051