aboutsummaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src/main/java/com/yahoo/container/plugin/classanalysis/PackageInfo.java
blob: d487e2b24d6dc5b41399b320e5cee22f0e690b26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.classanalysis;

import java.util.Optional;

/**
 * Info about a Java package deduced from class analysis.
 *
 * @author gjoranv
 */
record PackageInfo(String name, Optional<ExportPackageAnnotation> exportPackage, boolean isPublicApi) {

    /**
     * Returns this if it has an ExportPackage annotation, otherwise returns the other.
     * Used to combine objects, where this should take precedence over the other.
     */
    PackageInfo hasExportPackageOrElse(PackageInfo other) {
        return exportPackage().isPresent() ? this : other;
    }

}