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

com.jetbrains.plugin.structure.classes.resolvers.FileOrigin.kt Maven / Gradle / Ivy

Go to download

Base library for resolving class files and resources. Used by other JetBrains Plugins Structure Classes libraries.

The newest version!
/*
 * Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 */

package com.jetbrains.plugin.structure.classes.resolvers

import java.nio.file.Path

interface FileOrigin {
  val parent: FileOrigin?
}

inline fun  FileOrigin.findOriginOfType(): T? =
  generateSequence(this) { it.parent }.filterIsInstance().firstOrNull()

inline fun  FileOrigin.isOriginOfType(): Boolean = findOriginOfType() != null

data class JarOrZipFileOrigin(val fileName: String, override val parent: FileOrigin) : FileOrigin

data class DirectoryFileOrigin(val directoryName: String, override val parent: FileOrigin): FileOrigin

data class JdkFileOrigin(val jdkPath: Path) : FileOrigin {
  override val parent: FileOrigin? = null
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy