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

io.github.wistefan.mapping.Mapper Maven / Gradle / Ivy

There is a newer version: 1.2.11
Show newest version
package io.github.wistefan.mapping;

import io.github.wistefan.mapping.annotations.MappingEnabled;

import java.util.Arrays;
import java.util.Optional;

/**
 * Abstract superclass for mappers between NGSI-LD and the annotated objects
 */
public abstract class Mapper {

	/**
	 * Check if mapping is enabled for the given target class and return the {@link MappingEnabled} annotation in that case.
	 */
	protected static  Optional isMappingEnabled(Class tClass) {
		return Arrays.stream(tClass.getAnnotations())
				.filter(MappingEnabled.class::isInstance)
				.map(MappingEnabled.class::cast)
				.findFirst();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy