Class ArchiveType


  • @Contract
    @Singleton
    public abstract class ArchiveType
    extends Object
    ArchiveType is an extension over ModuleType defined in jsr88 API. It is analogous to type of an archive or a module or deployment unit, whichever way you prefer to call them. Adding a new archive type (or ArchiveType) is a very expensive operation. For example, there has been no new archive types introduced in Java EE since RAR type. Adding a new archive type involves writing an ArchiveHandler which involves writing logic to create class loaders. Now, that's not same as adding adding a technology type like jersey or jpa.

    This is only a contract. Actual types are made available as services by appropriate containers.

    GlassFish deployment framework uses the word container to refer to services. Containers are actually defined in Java EE platform spec. ArchiveType maps to the way containers are defined in the Java EE platform spec.

    Author:
    Sanjeeb Sahoo
    • Constructor Detail

      • ArchiveType

        protected ArchiveType​(String value,
                              String extension)
        Ensure a correct value is passed as that's what is returned by toString() which is sometimes used during comparison as some old APIs like ArchiveHandler.getArchiveType() use String.
        Parameters:
        value - value of this archive type as reported in toString()
        extension - file extension for this type of archive
      • ArchiveType

        protected ArchiveType​(String value)
        Same as calling #ArchiveType(String, String) with an empty string as extension.
    • Method Detail

      • getExtension

        public String getExtension()
        Return the file extension string for this module type.
      • toString

        public final String toString()
        Overrides:
        toString in class Object
        Returns:
        the string equivalent of this type.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object