1.1 --- a/lookup/src/main/java/org/openide/util/lookup/ServiceProvider.java Wed Jan 27 17:46:23 2010 -0500
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,102 +0,0 @@
1.4 -/*
1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1.6 - *
1.7 - * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
1.8 - *
1.9 - * The contents of this file are subject to the terms of either the GNU
1.10 - * General Public License Version 2 only ("GPL") or the Common
1.11 - * Development and Distribution License("CDDL") (collectively, the
1.12 - * "License"). You may not use this file except in compliance with the
1.13 - * License. You can obtain a copy of the License at
1.14 - * http://www.netbeans.org/cddl-gplv2.html
1.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
1.16 - * specific language governing permissions and limitations under the
1.17 - * License. When distributing the software, include this License Header
1.18 - * Notice in each file and include the License file at
1.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
1.20 - * particular file as subject to the "Classpath" exception as provided
1.21 - * by Sun in the GPL Version 2 section of the License file that
1.22 - * accompanied this code. If applicable, add the following below the
1.23 - * License Header, with the fields enclosed by brackets [] replaced by
1.24 - * your own identifying information:
1.25 - * "Portions Copyrighted [year] [name of copyright owner]"
1.26 - *
1.27 - * If you wish your version of this file to be governed by only the CDDL
1.28 - * or only the GPL Version 2, indicate your decision by adding
1.29 - * "[Contributor] elects to include this software in this distribution
1.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
1.31 - * single choice of license, a recipient has the option to distribute
1.32 - * your version of this file under either the CDDL, the GPL Version 2 or
1.33 - * to extend the choice of license to its licensees as provided above.
1.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
1.35 - * Version 2 license, then the option applies only if the new code is
1.36 - * made subject to such option by the copyright holder.
1.37 - *
1.38 - * Contributor(s):
1.39 - *
1.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
1.41 - */
1.42 -
1.43 -package org.openide.util.lookup;
1.44 -
1.45 -import java.lang.annotation.ElementType;
1.46 -import java.lang.annotation.Retention;
1.47 -import java.lang.annotation.RetentionPolicy;
1.48 -import java.lang.annotation.Target;
1.49 -import org.openide.util.Lookup;
1.50 -
1.51 -/**
1.52 - * Declarative registration of a singleton service provider.
1.53 - * By marking an implementation class with this annotation,
1.54 - * you automatically register that implementation, normally in {@link Lookup#getDefault}.
1.55 - * The class must be public and have a public no-argument constructor.
1.56 - * <p>Example of usage:
1.57 - * <pre>
1.58 - * package my.module;
1.59 - * import org.netbeans.spi.whatever.Thing;
1.60 - * import org.openide.util.lookup.ServiceProvider;
1.61 - * @ServiceProvider(service=Thing.class)
1.62 - * public class MyThing implements Thing {...}
1.63 - * </pre>
1.64 - * <p>would result in a resource file <code>META-INF/services/org.netbeans.spi.whatever.Thing</code>
1.65 - * containing the single line of text: <code>my.module.MyThing</code>
1.66 - * @see Lookups#metaInfServices(ClassLoader)
1.67 - * @since org.openide.util 7.20
1.68 - */
1.69 -@Retention(RetentionPolicy.SOURCE)
1.70 -@Target(ElementType.TYPE)
1.71 -public @interface ServiceProvider {
1.72 -
1.73 - /**
1.74 - * The interface (or abstract class) to register this implementation under.
1.75 - * It is an error if the implementation class is not in fact assignable to the interface.
1.76 - * <p>If you need to register one class under multiple interfaces, use {@link ServiceProviders}.
1.77 - * <p>Requests to look up the specified interface should result in this implementation.
1.78 - * Requests for any other types may or may not result in this implementation even if the
1.79 - * implementation is assignable to those types.
1.80 - */
1.81 - Class<?> service();
1.82 -
1.83 - /**
1.84 - * An optional position in which to register this service relative to others.
1.85 - * Lower-numbered services are returned in the lookup result first.
1.86 - * Services with no specified position are returned last.
1.87 - */
1.88 - int position() default Integer.MAX_VALUE;
1.89 -
1.90 - /**
1.91 - * An optional list of implementations (given as fully-qualified class names) which this implementation supersedes.
1.92 - * If specified, those implementations will not be loaded even if they were registered.
1.93 - * Useful on occasion to cancel a generic implementation and replace it with a more advanced one.
1.94 - */
1.95 - String[] supersedes() default {};
1.96 -
1.97 - /**
1.98 - * An optional path to register this implementation in.
1.99 - * For example, <code>Projects/sometype/Nodes</code> could be used.
1.100 - * This style of registration would be recognized by {@link Lookups#forPath}
1.101 - * rather than {@link Lookup#getDefault}.
1.102 - */
1.103 - String path() default "";
1.104 -
1.105 -}