Do not depend on javax.annotation, use JDT annotations instead.
Change-Id: Ie0e30b6ab0e1f7314f55aa40a0a667f6d7739ae7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
<artifactId>org.osgi.service.component.annotations</artifactId>
</dependency>
- <!-- Sodium bump: javax.annotation.Nullable and friends -->
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <version>3.0.2</version>
- <optional>true</optional>
- </dependency>
-
<!-- Testing Dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
this.portMapping = portMapping;
}
- public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Node>> changes) {
+ @Override
+ public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
LOG.info("onDataTreeChanged - {}", this.getClass().getSimpleName());
for (DataTreeModification<Node> change : changes) {
DataObjectModification<Node> rootNode = change.getRootNode();
<artifactId>mdsal-binding-generator</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <version>3.0.2</version>
- <scope>test</scope>
- <optional>true</optional>
- </dependency>
</dependencies>
<build>
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.transportpce.olm.stub;
import java.util.Optional;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.binding.api.BindingService;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class MountPointStub implements MountPoint {
+public class MountPointStub implements MountPoint {
private DataBroker dataBroker;
return Optional.empty();
}
- @Nonnull
@Override
public InstanceIdentifier<?> getIdentifier() {
return null;
<artifactId>org.osgi.service.component.annotations</artifactId>
</dependency>
- <!-- Sodium bump: javax.annotation.Nullable and friends -->
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <version>3.0.2</version>
- <optional>true</optional>
- </dependency>
-
<!-- Testing Dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
import java.util.Collection;
import java.util.Optional;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
this.tapiNetworkModelService = tapiNetworkModelService;
}
- public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Node>> changes) {
+ @Override
+ public void onDataTreeChanged(Collection<DataTreeModification<Node>> changes) {
LOG.info("onDataTreeChanged - {}", this.getClass().getSimpleName());
for (DataTreeModification<Node> change : changes) {
DataObjectModification<Node> rootNode = change.getRootNode();
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-runtime-spi</artifactId>
</dependency>
- <!-- Sodium bump: javax.annotation.Nullable and friends -->
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <version>3.0.2</version>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @param intialDataQName {@link QName} of initial simulator data
* @return device simulator (wrapper)
*/
- public DeviceWrapper createDeviceWrapper(@Nonnull String key, @Nonnull InputStream initialDataXmlInputStream,
- @Nonnull QName intialDataQName) {
+ public DeviceWrapper createDeviceWrapper(@NonNull String key, @NonNull InputStream initialDataXmlInputStream,
+ @NonNull QName intialDataQName) {
DeviceWrapper deviceWrapper =
DeviceWrapper.createDeviceWrapper(key, initialDataXmlInputStream, intialDataQName);
LOG.info("Creating a new device wrapper {}, {}", key, deviceWrapper);
* @param deviceIdentifier identifier of device simulator
* @return stored device or null if not found
*/
- public DeviceWrapper getDevice(@Nonnull String deviceIdentifier) {
+ public DeviceWrapper getDevice(@NonNull String deviceIdentifier) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(deviceIdentifier));
return internalStorage.get(deviceIdentifier);
}
import java.util.Map.Entry;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
* @param intialDataQName {@link QName} of initial data
* @return device simulator
*/
- public static DeviceWrapper createDeviceWrapper(@Nonnull String key, @Nonnull InputStream initialDataXmlInputStream,
- @Nonnull QName intialDataQName) {
+ public static DeviceWrapper createDeviceWrapper(@NonNull String key, @NonNull InputStream initialDataXmlInputStream,
+ @NonNull QName intialDataQName) {
requireNonNull(initialDataXmlInputStream, "Input stream cannot be null");
requireNonNull(intialDataQName, "QName cannot be null");
return createDeviceWrapper(key, Lists.newArrayList(
* @param initialData {@link List} of {@link Entry} values
* @return created {@link DeviceWrapper} with all initial data provided by initial data
*/
- public static DeviceWrapper createDeviceWrapper(@Nonnull String key,
- @Nonnull List<Entry<QName, InputStream>> initialData) {
+ public static DeviceWrapper createDeviceWrapper(@NonNull String key,
+ @NonNull List<Entry<QName, InputStream>> initialData) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(key), "The provided key cannot be null or empty");
Preconditions.checkArgument(initialData != null && !initialData.isEmpty(),
"Initial data cannot be null or empty");
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.DataObject;
@Override
@SuppressWarnings("unchecked")
public <T extends DataObject> Optional<T> getDataObject(
- @Nonnull NormalizedNode normalizedNode,
- @Nonnull QName rootNode) {
+ @NonNull NormalizedNode normalizedNode,
+ @NonNull QName rootNode) {
//Preconditions.checkNotNull(normalizedNode);
if (normalizedNode instanceof ContainerNode) {
YangInstanceIdentifier.PathArgument directChildIdentifier =
@Override
@SuppressWarnings("unchecked")
- public <T extends DataObject> Optional<T> getDataObjectFromRpc(@Nonnull NormalizedNode normalizedNode) {
+ public <T extends DataObject> Optional<T> getDataObjectFromRpc(@NonNull NormalizedNode normalizedNode) {
if (! (normalizedNode instanceof ContainerNode)) {
LOG.error("converting normalized node is not ContainerNode. It's actual type is {}",
@Override
@SuppressWarnings({"rawtypes","unchecked"})
- public <T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@Nonnull T object,
+ public <T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@NonNull T object,
Class dataObjectClass) {
Entry<YangInstanceIdentifier, NormalizedNode> normalizedNode =
codecRegistry.toNormalizedNode(InstanceIdentifier.create(dataObjectClass), object);
import java.io.Reader;
import java.io.Writer;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.Notification;
public interface DataObjectConverter {
<T extends DataObject> Optional<T> getDataObject(
- @Nonnull NormalizedNode normalizedNode,
- @Nonnull QName rootNode);
+ @NonNull NormalizedNode normalizedNode,
+ @NonNull QName rootNode);
<T extends DataObject> Optional<T> getDataObjectFromRpc(
- @Nonnull NormalizedNode normalizedNode);
+ @NonNull NormalizedNode normalizedNode);
Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull InputStream inputStream);
+ @NonNull InputStream inputStream);
Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull Reader inputReader, SchemaNode parentSchema);
+ @NonNull Reader inputReader, SchemaNode parentSchema);
Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull Reader inputReader);
+ @NonNull Reader inputReader);
- <T extends DataObject> Writer writerFromDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ <T extends DataObject> Writer writerFromDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType);
- <T extends DataObject> Writer writerFromRpcDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ <T extends DataObject> Writer writerFromRpcDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType, QName rpcOutputQName, String rpcName);
@SuppressWarnings("rawtypes")
- <T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@Nonnull T object, Class dataObjectClass);
+ <T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@NonNull T object, Class dataObjectClass);
interface ConvertType<T> {
Optional<NormalizedNode> toNormalizedNodes(T object, Class<T> clazz);
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.transportpce.test.DataStoreContext;
import org.opendaylight.yangtools.yang.binding.DataObject;
* @param dataStoreContextUtil datastore context util used to extract codec and schema context
* @return {@link AbstractDataObjectConverter}
*/
- public static DataObjectConverter createWithDataStoreUtil(@Nonnull DataStoreContext dataStoreContextUtil) {
+ public static DataObjectConverter createWithDataStoreUtil(@NonNull DataStoreContext dataStoreContextUtil) {
return new JSONDataObjectConverter(dataStoreContextUtil.getSchemaContext(),
dataStoreContextUtil.getBindingDOMCodecServices());
}
* @param codecRegistry codec registry used for converting
* @return converter
*/
- public static DataObjectConverter createWithSchemaContext(@Nonnull EffectiveModelContext schemaContext,
- @Nonnull BindingNormalizedNodeSerializer codecRegistry) {
+ public static DataObjectConverter createWithSchemaContext(@NonNull EffectiveModelContext schemaContext,
+ @NonNull BindingNormalizedNodeSerializer codecRegistry) {
return new JSONDataObjectConverter(schemaContext, codecRegistry);
}
*/
@Override
public Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull InputStream inputStream) {
+ @ NonNull InputStream inputStream) {
JsonReader reader = new JsonReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
return parseInputJSON(reader);
}
@Override
public Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull Reader inputReader, SchemaNode parentSchema) {
+ @NonNull Reader inputReader, SchemaNode parentSchema) {
throw new UnsupportedOperationException("Not Implemented yet");
}
@Override
public Optional<NormalizedNode> transformIntoNormalizedNode(
- @Nonnull Reader inputReader) {
+ @NonNull Reader inputReader) {
JsonReader reader = new JsonReader(inputReader);
return parseInputJSON(reader);
}
@Override
- public <T extends DataObject> Writer writerFromDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ public <T extends DataObject> Writer writerFromDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType) {
Writer writer = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(writer);
}
@Override
- public <T extends DataObject> Writer writerFromRpcDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ public <T extends DataObject> Writer writerFromRpcDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType, QName rpcOutputQName, String rpcName) {
return null;
}
import java.io.Writer;
import java.net.URISyntaxException;
import java.util.Optional;
-import javax.annotation.Nonnull;
import javax.xml.XMLConstants;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.transportpce.test.DataStoreContext;
import org.opendaylight.yangtools.yang.binding.DataObject;
* @param dataStoreContextUtil datastore context util used to extract codec and schema context
* @return {@link AbstractDataObjectConverter}
*/
- public static XMLDataObjectConverter createWithDataStoreUtil(@Nonnull DataStoreContext dataStoreContextUtil) {
+ public static XMLDataObjectConverter createWithDataStoreUtil(@NonNull DataStoreContext dataStoreContextUtil) {
BindingNormalizedNodeSerializer bindingToNormalizedNodeCodec =
dataStoreContextUtil.getBindingDOMCodecServices();
return new XMLDataObjectConverter(dataStoreContextUtil.getSchemaContext(), bindingToNormalizedNodeCodec);
* @param codecRegistry codec registry used for converting
* @return new {@link XMLDataObjectConverter}
*/
- public static XMLDataObjectConverter createWithSchemaContext(@Nonnull EffectiveModelContext schemaContext,
- @Nonnull BindingNormalizedNodeSerializer codecRegistry) {
+ public static XMLDataObjectConverter createWithSchemaContext(@NonNull EffectiveModelContext schemaContext,
+ @NonNull BindingNormalizedNodeSerializer codecRegistry) {
return new XMLDataObjectConverter(schemaContext, codecRegistry);
}
* @return {@link Optional} instance of {@link NormalizedNode}.
*/
@Override
- public Optional<NormalizedNode> transformIntoNormalizedNode(@Nonnull InputStream inputStream) {
+ public Optional<NormalizedNode> transformIntoNormalizedNode(@NonNull InputStream inputStream) {
try {
XMLStreamReader reader = this.xmlInputFactory.createXMLStreamReader(inputStream);
return parseInputXML(reader);
}
@Override
- public Optional<NormalizedNode> transformIntoNormalizedNode(@Nonnull Reader inputReader) {
+ public Optional<NormalizedNode> transformIntoNormalizedNode(@NonNull Reader inputReader) {
try {
XMLStreamReader reader = this.xmlInputFactory.createXMLStreamReader(inputReader);
return parseInputXML(reader);
* @param inputReader of the given XML
* @return {@link Optional} instance of {@link NormalizedNode}.
*/
- public Optional<NormalizedNode> transformInschemaContexttoNormalizedNode(@Nonnull Reader inputReader) {
+ public Optional<NormalizedNode> transformInschemaContexttoNormalizedNode(@NonNull Reader inputReader) {
try {
XMLStreamReader reader = this.xmlInputFactory.createXMLStreamReader(inputReader);
return parseInputXML(reader);
}
@Override
- public <T extends DataObject> Writer writerFromRpcDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ public <T extends DataObject> Writer writerFromRpcDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType, QName rpcOutputQName, String rpcName) {
Writer writer = new StringWriter();
XMLStreamWriter xmlStreamWriter = createXmlStreamWriter(writer);
*
*/
@Override
- public <T extends DataObject> Writer writerFromDataObject(@Nonnull DataObject object, Class<T> dataObjectClass,
+ public <T extends DataObject> Writer writerFromDataObject(@NonNull DataObject object, Class<T> dataObjectClass,
ConvertType<T> convertType) {
Writer writer = new StringWriter();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.transportpce.test.stub;
import java.util.Optional;
-import javax.annotation.Nonnull;
import org.opendaylight.mdsal.binding.api.BindingService;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.MountPoint;
return Optional.empty();
}
- @Nonnull
@Override
public InstanceIdentifier<?> getIdentifier() {
throw new UnsupportedOperationException();
private static final Logger LOG = LoggerFactory.getLogger(TopologyDataUtils.class);
- @SuppressWarnings({"unchecked","rawtypes"})
+ @SuppressWarnings("rawtypes")
// FIXME check if the InstanceIdentifier raw type can be avoided
// Raw types use are discouraged since they lack type safety.
// Resulting Problems are observed at run time and not at compile time