Home / Class/ Version Class — netty Architecture

Version Class — netty Architecture

Architecture documentation for the Version class in Version.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b4bb7d14_c3bd_44e2_2053_326a8139b348["Version"]
  5ec5f9d1_182e_6d15_221b_ea9fbcd30031["Version.java"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|defined in| 5ec5f9d1_182e_6d15_221b_ea9fbcd30031
  3c7cc3ad_f740_8e0b_dc4d_85608875aedf["identify()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| 3c7cc3ad_f740_8e0b_dc4d_85608875aedf
  e9e1fab3_6b60_d4fb_35dd_63c3aae6c189["parseIso8601()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| e9e1fab3_6b60_d4fb_35dd_63c3aae6c189
  ece38864_f0d3_17c5_8f74_a3196037bc8c["main()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| ece38864_f0d3_17c5_8f74_a3196037bc8c
  960412f3_78da_f6cc_9a9f_3024386867fd["Version()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| 960412f3_78da_f6cc_9a9f_3024386867fd
  b81f0ce5_af4d_cc39_134e_33e343729959["String()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| b81f0ce5_af4d_cc39_134e_33e343729959
  fcbdb351_ec1d_63da_da9f_dc2061ed92ec["buildTimeMillis()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| fcbdb351_ec1d_63da_da9f_dc2061ed92ec
  8197cbb4_5205_9b4a_3cb3_b1077225a6f4["commitTimeMillis()"]
  b4bb7d14_c3bd_44e2_2053_326a8139b348 -->|method| 8197cbb4_5205_9b4a_3cb3_b1077225a6f4

Relationship Graph

Source Code

common/src/main/java/io/netty/util/Version.java lines 40–203

public final class Version {

    private static final String PROP_VERSION = ".version";
    private static final String PROP_BUILD_DATE = ".buildDate";
    private static final String PROP_COMMIT_DATE = ".commitDate";
    private static final String PROP_SHORT_COMMIT_HASH = ".shortCommitHash";
    private static final String PROP_LONG_COMMIT_HASH = ".longCommitHash";
    private static final String PROP_REPO_STATUS = ".repoStatus";

    /**
     * Retrieves the version information of Netty artifacts using the current
     * {@linkplain Thread#getContextClassLoader() context class loader}.
     *
     * @return A {@link Map} whose keys are Maven artifact IDs and whose values are {@link Version}s
     */
    public static Map<String, Version> identify() {
        return identify(null);
    }

    /**
     * Retrieves the version information of Netty artifacts using the specified {@link ClassLoader}.
     *
     * @return A {@link Map} whose keys are Maven artifact IDs and whose values are {@link Version}s
     */
    public static Map<String, Version> identify(ClassLoader classLoader) {
        if (classLoader == null) {
            classLoader = PlatformDependent.getContextClassLoader();
        }

        // Collect all properties.
        Properties props = new Properties();
        try {
            Enumeration<URL> resources = classLoader.getResources("META-INF/io.netty.versions.properties");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                InputStream in = url.openStream();
                try {
                    props.load(in);
                } finally {
                    try {
                        in.close();
                    } catch (Exception ignore) {
                        // Ignore.
                    }
                }
            }
        } catch (Exception ignore) {
            // Not critical. Just ignore.
        }

        // Collect all artifactIds.
        Set<String> artifactIds = new HashSet<String>();
        for (Object o: props.keySet()) {
            String k = (String) o;

            int dotIndex = k.indexOf('.');
            if (dotIndex <= 0) {
                continue;
            }

            String artifactId = k.substring(0, dotIndex);

            // Skip the entries without required information.
            if (!props.containsKey(artifactId + PROP_VERSION) ||
                !props.containsKey(artifactId + PROP_BUILD_DATE) ||
                !props.containsKey(artifactId + PROP_COMMIT_DATE) ||
                !props.containsKey(artifactId + PROP_SHORT_COMMIT_HASH) ||
                !props.containsKey(artifactId + PROP_LONG_COMMIT_HASH) ||
                !props.containsKey(artifactId + PROP_REPO_STATUS)) {
                continue;
            }

            artifactIds.add(artifactId);
        }

        Map<String, Version> versions = new TreeMap<String, Version>();
        for (String artifactId: artifactIds) {
            versions.put(
                    artifactId,
                    new Version(
                            artifactId,

Frequently Asked Questions

What is the Version class?
Version is a class in the netty codebase, defined in common/src/main/java/io/netty/util/Version.java.
Where is Version defined?
Version is defined in common/src/main/java/io/netty/util/Version.java at line 40.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free