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

org.mapstruct.ap.internal.model.Annotation Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
/*
 * Copyright MapStruct Authors.
 *
 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */
package org.mapstruct.ap.internal.model;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.mapstruct.ap.internal.model.annotation.AnnotationElement;
import org.mapstruct.ap.internal.model.common.ModelElement;
import org.mapstruct.ap.internal.model.common.Type;

/**
 * Represents a Java 5 annotation.
 *
 * @author Gunnar Morling
 */
public class Annotation extends ModelElement {

    private final Type type;

    private List properties;

    public Annotation(Type type) {
        this( type, Collections.emptyList() );
    }

    public Annotation(Type type, List properties) {
        this.type = type;
        this.properties = properties;
    }

    public Type getType() {
        return type;
    }

    @Override
    public Set getImportTypes() {
        Set types = new HashSet<>();
        for ( AnnotationElement prop : properties ) {
            types.addAll( prop.getImportTypes() );
        }
        types.add( type );
        return types;
    }

    public List getProperties() {
        return properties;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy