All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.osgi.annotation.bundle.Requirement Maven / Gradle / Ivy

Go to download

AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based @AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step. This library is a superset of AspectJ weaver and hence also of AspectJ runtime.

There is a newer version: 1.9.22.1
Show newest version
/*******************************************************************************
 * Copyright (c) Contributors to the Eclipse Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0 
 *******************************************************************************/

package org.osgi.annotation.bundle;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Define a requirement for a bundle.
 * 

* For example: * *

 * @Requirement(namespace=ExtenderNamespace.EXTENDER_NAMESPACE,
 *              name="osgi.component", version="1.3.0")
 * 
*

* This annotation is not retained at runtime. It is for use by tools to * generate bundle manifests or otherwise process the a package. *

* This annotation can be used to annotate an annotation. * * @author $Id: 5ce4279b29f0f3b383b4e538c6d1ba512aecbac8 $ */ @Documented @Retention(RetentionPolicy.CLASS) @Target({ ElementType.TYPE, ElementType.PACKAGE }) @Repeatable(Requirements.class) public @interface Requirement { /** * The namespace of this requirement. */ String namespace(); /** * The name of this requirement within the namespace. *

* If specified, adds an expression, using the {@code &} operator with any * specified {@link #filter()}, to the requirement's filter directive to * test that an attribute with the name of the namespace is equal to the * value of the specified name. */ String name() default ""; /** * The floor version of the version range for this requirement. *

* If specified, adds a version range expression, using the {@code &} * operator with any specified {@link #filter()}, to the requirement's * filter directive. The ceiling version of the version range is the next * major version from the floor version. For example, if the specified * version is {@code 1.3}, then the version range expression is * {@code (&(version>=1.3)(!(version>=2.0)))}. *

* The specified version must be a valid OSGi version string. */ String version() default ""; /** * The filter expression of this requirement, if any. */ String filter() default ""; /** * The effective time of this requirement. *

* Specifies the time the requirement is available. The OSGi framework * resolver only considers requirement without an effective directive or * effective:=resolve. Requirements with other values for the effective * directive can be considered by an external agent. *

* If not specified, the {@code effective} directive is omitted from the * requirement clause. */ String effective() default "resolve"; // Namespace.EFFECTIVE_RESOLVE /** * A list of attribute or directive names and values. *

* Each string should be specified in the form: *

    *
  • {@code "name=value"} for attributes.
  • *
  • {@code "name:type=value"} for typed attributes.
  • *
  • {@code "name:=value"} for directives.
  • *
* These are added, separated by semicolons, to the requirement clause. */ String[] attribute() default {}; /** * The cardinality of this requirement. *

* Indicates if this requirement can be wired a single time or multiple * times. *

* If not specified, the {@code cardinality} directive is omitted from the * requirement clause. */ Cardinality cardinality() default Cardinality.SINGLE; /** * Cardinality for this requirement. */ public enum Cardinality { /** * Indicates if the requirement can only be wired a single time. */ SINGLE("single"), // Namespace.CARDINALITY_SINGLE /** * Indicates if the requirement can be wired multiple times. */ MULTIPLE("multiple"); // Namespace.CARDINALITY_MULTIPLE private final String value; Cardinality(String value) { this.value = value; } @Override public String toString() { return value; } } /** * The resolution policy of this requirement. *

* A mandatory requirement forbids the bundle to resolve when this * requirement is not satisfied; an optional requirement allows a bundle to * resolve even if this requirement is not satisfied. *

* If not specified, the {@code resolution} directive is omitted from the * requirement clause. */ Resolution resolution() default Resolution.MANDATORY; /** * Resolution for this requirement. */ public enum Resolution { /** * A mandatory requirement forbids the bundle to resolve when the * requirement is not satisfied. */ MANDATORY("mandatory"), // Namespace.RESOLUTION_MANDATORY /** * An optional requirement allows a bundle to resolve even if the * requirement is not satisfied. */ OPTIONAL("optional"); // Namespace.RESOLUTION_OPTIONAL private final String value; Resolution(String value) { this.value = value; } @Override public String toString() { return value; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy