Skip to content

Commit

Permalink
[util] Addd the annotation DefaultSpace.
Browse files Browse the repository at this point in the history
This annotation may be used by the SARL developers in order to inject
the default space instance into a space specification.

see #66

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Sep 22, 2019
1 parent 69538e4 commit 6549c38
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
3 changes: 2 additions & 1 deletion main/apiplugins/io.sarl.util/META-INF/MANIFEST.MF
Expand Up @@ -10,5 +10,6 @@ Export-Package: io.sarl.eventdispatching,
io.sarl.sarlspecification,
io.sarl.util
Require-Bundle: io.sarl.lang.core;bundle-version="0.10.0";visibility:=reexport,
org.eclipse.osgi;bundle-version="3.15.0"
org.eclipse.osgi;bundle-version="3.15.0",
com.google.inject;bundle-version="4.1.0"

54 changes: 54 additions & 0 deletions main/apiplugins/io.sarl.util/src/io/sarl/util/DefaultSpace.sarl
@@ -0,0 +1,54 @@
/*
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2019 the original authors or authors.
*
* 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.
*/

package io.sarl.util

import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target
import com.google.inject.BindingAnnotation

/**
* Annotation that is used for marking formal parameters and object fields in order to
* received the default space instance of a SARL context.
*
* <p>This annotation has the contract to be associated to: i) a formal parameter or an object field
* of type {@link OpenEventspace} and to the {@code @Inject} annotation, and ii) to be used only
* inside a subtype of {@code Space}.
*
* <p>When a formal parameter or a field is in a subtype of {@code Space} and it is injectable and
* marked with this annotation, the SARL run-time environment is supposed to inject the instance
* of the default space of the context in which the injected space is located.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.10
*/
@Target(ElementType::PARAMETER, ElementType::FIELD)
@Retention(RetentionPolicy::RUNTIME)
@BindingAnnotation
annotation DefaultSpace {
//
}

5 changes: 3 additions & 2 deletions main/features/io.sarl.lib/feature.xml
Expand Up @@ -224,11 +224,12 @@
<requires>
<import plugin="io.sarl.lang.core" version="0.10.0" match="greaterOrEqual"/>
<import plugin="io.sarl.util" version="0.10.0" match="greaterOrEqual"/>
<import plugin="javax.inject" version="1.0.0" match="greaterOrEqual"/>
<import plugin="io.sarl.core" version="0.10.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.osgi" version="3.15.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.xbase.lib" version="2.19.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtend.lib" version="2.19.0" match="greaterOrEqual"/>
<import plugin="javax.inject" version="1.0.0" match="greaterOrEqual"/>
<import plugin="io.sarl.core" version="0.10.0" match="greaterOrEqual"/>
<import plugin="com.google.inject" version="4.1.0" match="greaterOrEqual"/>
</requires>

<plugin
Expand Down

0 comments on commit 6549c38

Please sign in to comment.