Class DependsFileParser


  • public final class DependsFileParser
    extends java.lang.Object
    Trivial parser to handle depends-plugin-style files.
    Since:
    2.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BUILDTIME_KEY
      The key where the build time as found within the dependencies.properties file is found.
      private static java.lang.String DEPENDENCIES_PROPERTIES_FILE  
      private static java.lang.String GENERATION_PREFIX  
      private static java.lang.String GROUP_ARTIFACT_SEPARATOR  
      private static java.lang.String KEY_VALUE_SEPARATOR  
      static java.lang.String OWN_ARTIFACTID_KEY
      The key holding the artifactId of this plugin (within the dependencies.properties file).
      static java.lang.String OWN_GROUPID_KEY
      The key holding the groupId of this plugin (within the dependencies.properties file).
      static java.lang.String OWN_VERSION_KEY
      The key holding the version of this plugin (within the dependencies.properties file).
      private static java.lang.String SCOPE_LINE_INDICATOR
      String indicating that a line in a dependencies.properties file contains a scope definition.
      private static java.lang.String TYPE_LINE_INDICATOR
      String indicating that a line in a dependencies.properties file contains a type definition.
      private static java.lang.String VERSION_LINE_INDICATOR
      String indicating that a line in a dependencies.properties file contains a version definition.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DependsFileParser()
      Hide constructors for utility classes
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.SortedMap<java.lang.String,​DependencyInfo> createDependencyInfoMap​(java.util.SortedMap<java.lang.String,​java.lang.String> versionMap)
      Converts a SortedMap received from a getVersionMap call to hold DependencyInfo values, and keys on the form groupId/artifactId.
      static java.util.SortedMap<java.lang.String,​java.lang.String> getVersionMap​(java.lang.String artifactId)
      Extracts all build-time dependency information from a dependencies.properties file embedded in this plugin's JAR.
      static java.util.SortedMap<java.lang.String,​java.lang.String> getVersionMap​(java.net.URL anURL)
      Extracts all build-time dependency information from a dependencies.properties file embedded in this plugin's JAR.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VERSION_LINE_INDICATOR

        private static final java.lang.String VERSION_LINE_INDICATOR
        String indicating that a line in a dependencies.properties file contains a version definition.
        See Also:
        Constant Field Values
      • TYPE_LINE_INDICATOR

        private static final java.lang.String TYPE_LINE_INDICATOR
        String indicating that a line in a dependencies.properties file contains a type definition.
        See Also:
        Constant Field Values
      • SCOPE_LINE_INDICATOR

        private static final java.lang.String SCOPE_LINE_INDICATOR
        String indicating that a line in a dependencies.properties file contains a scope definition.
        See Also:
        Constant Field Values
      • GROUP_ARTIFACT_SEPARATOR

        private static final java.lang.String GROUP_ARTIFACT_SEPARATOR
        See Also:
        Constant Field Values
      • KEY_VALUE_SEPARATOR

        private static final java.lang.String KEY_VALUE_SEPARATOR
        See Also:
        Constant Field Values
      • DEPENDENCIES_PROPERTIES_FILE

        private static final java.lang.String DEPENDENCIES_PROPERTIES_FILE
        See Also:
        Constant Field Values
      • GENERATION_PREFIX

        private static final java.lang.String GENERATION_PREFIX
        See Also:
        Constant Field Values
      • BUILDTIME_KEY

        public static final java.lang.String BUILDTIME_KEY
        The key where the build time as found within the dependencies.properties file is found.
        See Also:
        Constant Field Values
      • OWN_ARTIFACTID_KEY

        public static final java.lang.String OWN_ARTIFACTID_KEY
        The key holding the artifactId of this plugin (within the dependencies.properties file).
        See Also:
        Constant Field Values
      • OWN_GROUPID_KEY

        public static final java.lang.String OWN_GROUPID_KEY
        The key holding the groupId of this plugin (within the dependencies.properties file).
        See Also:
        Constant Field Values
      • OWN_VERSION_KEY

        public static final java.lang.String OWN_VERSION_KEY
        The key holding the version of this plugin (within the dependencies.properties file).
        See Also:
        Constant Field Values
    • Constructor Detail

      • DependsFileParser

        private DependsFileParser()
        Hide constructors for utility classes
    • Method Detail

      • getVersionMap

        public static java.util.SortedMap<java.lang.String,​java.lang.String> getVersionMap​(java.lang.String artifactId)
        Extracts all build-time dependency information from a dependencies.properties file embedded in this plugin's JAR.
        Parameters:
        artifactId - This plugin's artifactId.
        Returns:
        A SortedMap relating [groupId]/[artifactId] keys to DependencyInfo values.
        Throws:
        java.lang.IllegalStateException - if no artifact in the current Thread's context ClassLoader contained the supplied artifactNamePart.
      • getVersionMap

        public static java.util.SortedMap<java.lang.String,​java.lang.String> getVersionMap​(java.net.URL anURL)
        Extracts all build-time dependency information from a dependencies.properties file embedded in this plugin's JAR.
        Parameters:
        anURL - The non-empty URL to a dependencies.properties file.
        Returns:
        A SortedMap holding all entries in the dependencies.properties file, plus its build time which is found under the buildtime key.
        Throws:
        java.lang.IllegalStateException - if no artifact in the current Thread's context ClassLoader contained the supplied artifactNamePart.
      • createDependencyInfoMap

        public static java.util.SortedMap<java.lang.String,​DependencyInfo> createDependencyInfoMap​(java.util.SortedMap<java.lang.String,​java.lang.String> versionMap)
        Converts a SortedMap received from a getVersionMap call to hold DependencyInfo values, and keys on the form groupId/artifactId.
        Parameters:
        versionMap - A non-null Map, as received from a call to getVersionMap.
        Returns:
        a SortedMap received from a getVersionMap call to hold DependencyInfo values, and keys on the form groupId/artifactId.