Class Dependency

java.lang.Object
io.spring.initializr.metadata.MetadataElement
io.spring.initializr.metadata.Dependency
All Implemented Interfaces:
Describable

public class Dependency extends MetadataElement implements Describable
Meta-data for a dependency. Each dependency has a primary identifier and an arbitrary number of aliases.
Author:
Stephane Nicoll
  • Field Details

  • Constructor Details

    • Dependency

      public Dependency()
    • Dependency

      public Dependency(Dependency dependency)
  • Method Details

    • setScope

      public void setScope(String scope)
    • setCompatibilityRange

      public void setCompatibilityRange(String compatibilityRange)
    • resolve

      public void resolve()
      Validate the dependency and complete its state based on the available information.
    • updateCompatibilityRange

      public void updateCompatibilityRange(VersionParser versionParser)
    • resolve

      public Dependency resolve(Version bootVersion)
      Resolve this instance according to the specified Spring Boot Version. Return a Dependency instance that has its state resolved against the specified version.
      Parameters:
      bootVersion - the Spring Boot version
      Returns:
      this instance
    • match

      public boolean match(Version version)
      Specify if this dependency is available for the specified Spring Boot version.
      Parameters:
      version - the version the check
      Returns:
      of the version matches
    • generateId

      public String generateId()
      Generate an id using the groupId and artifactId.
      Returns:
      the generated ID
    • getAliases

      public List<String> getAliases()
    • setAliases

      public void setAliases(List<String> aliases)
    • getFacets

      public List<String> getFacets()
    • setFacets

      public void setFacets(List<String> facets)
    • getGroupId

      public String getGroupId()
    • setGroupId

      public void setGroupId(String groupId)
    • getArtifactId

      public String getArtifactId()
    • setArtifactId

      public void setArtifactId(String artifactId)
    • getVersion

      public String getVersion()
      Return the default version, can be null to indicate that the version is managed by the project and does not need to be specified.
      Returns:
      the default version or null
    • setVersion

      public void setVersion(String version)
    • getClassifier

      public String getClassifier()
      Return the classifier, can be null to indicate that no classifier is available.
      Returns:
      the classifier or null
    • setClassifier

      public void setClassifier(String classifier)
    • getType

      public String getType()
      Return the type, can be null to indicate that the default type should be used (i.e. jar).
      Returns:
      the type or null
    • setType

      public void setType(String type)
    • getMappings

      public List<Dependency.Mapping> getMappings()
      Return the dependency mapping if an attribute of the dependency differs according to the Spring Boot version. If no mapping matches, default attributes are used.
      Returns:
      the dependency mappings
    • setMappings

      public void setMappings(List<Dependency.Mapping> mappings)
    • getDescription

      public String getDescription()
      Description copied from interface: Describable
      Returns the item description.
      Specified by:
      getDescription in interface Describable
      Returns:
      the description
    • setDescription

      public void setDescription(String description)
    • getVersionRequirement

      public String getVersionRequirement()
    • setVersionRequirement

      public void setVersionRequirement(String versionRequirement)
    • getRange

      public VersionRange getRange()
    • setRange

      public void setRange(VersionRange range)
    • getBom

      public String getBom()
    • setBom

      public void setBom(String bom)
    • getRepository

      public String getRepository()
    • setRepository

      public void setRepository(String repository)
    • getWeight

      public int getWeight()
    • setWeight

      public void setWeight(int weight)
    • isStarter

      public boolean isStarter()
    • setStarter

      public void setStarter(boolean starter)
    • getKeywords

      public List<String> getKeywords()
    • setKeywords

      public void setKeywords(List<String> keywords)
    • getLinks

      public List<Link> getLinks()
    • setLinks

      public void setLinks(List<Link> links)
    • getScope

      public String getScope()
    • getCompatibilityRange

      public String getCompatibilityRange()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • create

      public static Dependency create(String groupId, String artifactId, String version, String scope)
    • createSpringBootStarter

      public static Dependency createSpringBootStarter(String name)
    • createSpringBootStarter

      public static Dependency createSpringBootStarter(String name, String scope)
    • withId

      public static Dependency withId(String id, String groupId, String artifactId, String version, String scope)
    • withId

      public static Dependency withId(String id, String groupId, String artifactId, String version)
    • withId

      public static Dependency withId(String id, String groupId, String artifactId)
    • withId

      public static Dependency withId(String id, String scope)
    • withId

      public static Dependency withId(String id)