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

com.jetbrains.plugin.structure.intellij.beans.ModuleBean.kt Maven / Gradle / Ivy

Go to download

Library for parsing JetBrains IDE plugins. Can be used to verify that plugin complies with the JetBrains Marketplace requirements.

There is a newer version: 3.290
Show newest version
package com.jetbrains.plugin.structure.intellij.beans

import java.nio.file.Path
import javax.xml.bind.annotation.XmlAttribute
import javax.xml.bind.annotation.XmlElement
import javax.xml.bind.annotation.XmlElementWrapper
import javax.xml.bind.annotation.XmlRootElement

private const val DEFAULT_NAME: String = "##default"
private const val DEFAULT_PATH: String = "##default"

@XmlRootElement(name = "module")
data class ModuleBean(
  @field:XmlAttribute(name = "name") val name: String,

  @field:XmlElementWrapper(name = "dependencies")
  @field:XmlElement(name = "module")
  val dependencies: List = emptyList(),

  @field:XmlElementWrapper(name = "resources")
  @field:XmlElement(name = "resource-root")
  val resources: List = emptyList()
) {
  @Suppress("unused")
  constructor() : this(
    name = "",
    dependencies = mutableListOf(),
    resources = mutableListOf()
  )

  data class ModuleDependency(
    @field:XmlAttribute(name = "name") val name: String
  ) {
    @Suppress("unused")
    constructor() : this(DEFAULT_NAME)
  }

  data class ResourceRoot(
    @field:XmlAttribute(name = "path") private val pathValue: String
  ) {
    @Suppress("unused")
    constructor() : this(DEFAULT_PATH)

    val path: Path
      get() {
        if (pathValue == DEFAULT_PATH) {
          throw IllegalStateException("Resource root path is not set")
        }
        return Path.of(pathValue)
      }
  }
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy