1831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye/* 2831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * Copyright (C) 2013 The Android Open Source Project 3831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * 4831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * Licensed under the Apache License, Version 2.0 (the "License"); 5831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * you may not use this file except in compliance with the License. 6831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * You may obtain a copy of the License at 7831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * 8831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * http://www.apache.org/licenses/LICENSE-2.0 9831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * 10831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * Unless required by applicable law or agreed to in writing, software 11831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * distributed under the License is distributed on an "AS IS" BASIS, 12831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * See the License for the specific language governing permissions and 14831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * limitations under the License. 15831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye */ 16831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyepackage android.annotation; 17831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye 18831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyeimport java.lang.annotation.Retention; 19831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyeimport java.lang.annotation.Target; 20831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye 21831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyeimport static java.lang.annotation.ElementType.ANNOTATION_TYPE; 22831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyeimport static java.lang.annotation.RetentionPolicy.CLASS; 23831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye 24831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye/** 25831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * Denotes that the annotated String element, represents a logical 26831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * type and that its value should be one of the explicitly named constants. 27831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * <p> 28831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * Example: 2971fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * <pre><code> 30831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * @Retention(SOURCE) 3171fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * @StringDef({ 32831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * POWER_SERVICE, 33831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * WINDOW_SERVICE, 34831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * LAYOUT_INFLATER_SERVICE 3571fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * }) 3671fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * public @interface ServiceName {} 37831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * public static final String POWER_SERVICE = "power"; 38831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * public static final String WINDOW_SERVICE = "window"; 39831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater"; 40831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * ... 4171fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * public abstract Object getSystemService(@ServiceName String name); 4271fbb81b14958b80fe55738607740c6630e4e9daNeil Fuller * </code></pre> 43831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * 44831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye * @hide 45831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye */ 46831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye@Retention(CLASS) 47831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye@Target({ANNOTATION_TYPE}) 48831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbyepublic @interface StringDef { 49831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye /** Defines the allowed constants for this element */ 50831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye String[] value() default {}; 51831c5df6035b84bfcb3242c5c0a39acd7e3fd1b5Tor Norbye} 52