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

org.babyfish.jimmer.mapstruct.ap.ImmutableUtils Maven / Gradle / Ivy

There is a newer version: 0.9.35
Show newest version
package org.babyfish.jimmer.mapstruct.ap;

import org.babyfish.jimmer.Immutable;
import org.babyfish.jimmer.sql.Embeddable;
import org.babyfish.jimmer.sql.Entity;
import org.babyfish.jimmer.sql.MappedSuperclass;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;

class ImmutableUtils {

    private ImmutableUtils() {}

    public static boolean isImmutable(Element element) {
        if (element.getKind() != ElementKind.INTERFACE) {
            return false;
        }
        TypeElement typeElement = (TypeElement) element;
        return typeElement.getAnnotation(Immutable.class) != null ||
                typeElement.getAnnotation(Entity.class) != null ||
                typeElement.getAnnotation(MappedSuperclass.class) != null ||
                typeElement.getAnnotation(Embeddable.class) != null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy