Class Spec

java.lang.Object
org.glassfish.spec.Spec

public class Spec extends Object
The API specification.
  • Field Details

    • JAVAX_GROUP_ID

      public static final String JAVAX_GROUP_ID
      GroupId used for JavaEE specs.
      See Also:
    • JAKARTA_GROUP_ID

      public static final String JAKARTA_GROUP_ID
      GroupId used for JakartaEE specs.
      See Also:
    • artifact

      private Artifact artifact
      The Spec Artifact.
    • metadata

      private Metadata metadata
      The Spec Artifact Metadata.
    • jar

      private JarFile jar
      The Spec JAR file.
    • specMode

      private SpecMode specMode
      The Spec mode ("javaee" or "jakarta"). Default value is
      invalid reference
      SpecMode.JAKARTA
      .
    • specVersion

      private String specVersion
      The Spec Version.
    • newSpecVersion

      private String newSpecVersion
      The new Spec Version (for non final API).
    • specImplVersion

      private String specImplVersion
      The Spec Implementation Version.
    • implVersion

      private String implVersion
      The Spec Implementation Version.
    • newImplVersion

      private String newImplVersion
      The Spec Implementation Version.
    • specBuild

      private String specBuild
      The Spec Build Number.
    • implBuild

      private String implBuild
      The Spec Implementation Builder Number.
    • apiPackage

      private String apiPackage
      The Spec API Package.
    • implNamespace

      private String implNamespace
      The Spec Implementation Namespace.
    • nonFinal

      private boolean nonFinal
      The Spec Final flag.
    • jarType

      private Spec.JarType jarType
      The Spec Jar Type see Spec.JarType.
    • errors

      private final List<String> errors
      The errors during spec verification.
    • NONFINAL_BUILD_SEPARATOR_SPEC

      private static final String NONFINAL_BUILD_SEPARATOR_SPEC
      Constant for Non Final API Build Spec Separator.
      See Also:
    • NONFINAL_BUILD_SEPARATOR

      private static final String NONFINAL_BUILD_SEPARATOR
      Constant for Non Final API Build Separator.
      See Also:
    • JCP_VERSION_RULE

      private static final String JCP_VERSION_RULE
      Constant for JCP Version Rule.
      See Also:
    • API_SUFFIX

      public static final String API_SUFFIX
      ArtifactId suffix for Spec with api JarType.
      See Also:
  • Constructor Details

    • Spec

      public Spec()
      Create a new instance of Spec.
  • Method Details

    • read

      public void read(JarFile jarfile) throws IOException
      Populate the spec artifact and metadata from the given JAR file.
      Parameters:
      jarfile - the JAR file to process
      Throws:
      IOException - if an error occurs while reading the JAR file
    • checkClasses

      private void checkClasses(JarFile jarfile, String... pkgs)
      Verify that the classes inside the given jarFile match the right package.
      Parameters:
      jarfile - the JAR file to process
      pkgs - the packages to match
    • verifyApiPackagePrefix

      private void verifyApiPackagePrefix()
      Verify that apiPackage starts with proper prefix. Verification depends on current spec mode:
      • javaee: strict check for required prefix
      • jakarta: both currently supported prefixes are allowed
    • verify

      public void verify()
      Perform the Spec verification.
    • getArtifact

      public Artifact getArtifact()
      Get the Spec Artifact.
      Returns:
      the artifact
    • getMetadata

      public Metadata getMetadata()
      Get the Spec Metadata.
      Returns:
      the metadata
    • getErrors

      public List<String> getErrors()
      Get the errors collected during verification.
      Returns:
      the list of errors
    • setSpecMode

      public void setSpecMode(String name)
      Set spec mode value for this spec.
      Parameters:
      name - spec mode value matching lower case value of SpecMode name attribute
    • setApiPackage

      public void setApiPackage(String pkg)
      Set the API package for this spec.
      Parameters:
      pkg - the apiPackage to use
    • buildBundleSymbolicName

      public String buildBundleSymbolicName()
      Build bundle symbolic name from API package and API_SUFFIX.
      Returns:
      bundle symbolic name value to be supplied as spec.bundle.symbolic-name property.
    • setImplNamespace

      public void setImplNamespace(String namespace)
      Set the implementation namespace for this spec.
      Parameters:
      namespace - the implementation namespace
    • setImplVersion

      public void setImplVersion(String version)
      Set the implementation version for this spec.
      Parameters:
      version - the implementation version
    • setSpecVersion

      public void setSpecVersion(String version)
      Set the spec version for this spec.
      Parameters:
      version - the spec version
    • setNewImplVersion

      public void setNewImplVersion(String version)
      Set the new spec implementation version for this spec.
      Parameters:
      version - the spec version
    • setSpecBuild

      public void setSpecBuild(String build)
      Set the spec build for this spec.
      Parameters:
      build - the spec build
    • setSpecImplVersion

      public void setSpecImplVersion(String version)
      Set the spec implementation version for this spec.
      Parameters:
      version - the spec implementation version
    • setNewSpecVersion

      public void setNewSpecVersion(String version)
      Set the new spec version for this spec.
      Parameters:
      version - the new spec version
    • setImplBuild

      public void setImplBuild(String build)
      Set the implementation build for this spec.
      Parameters:
      build - the implementation build
    • setArtifact

      public void setArtifact(Artifact a)
      Set the artifact for this spec.
      Parameters:
      a - the artifact to use
    • setNonFinal

      public void setNonFinal(boolean nfinal)
      Set the spec non final flag.
      Parameters:
      nfinal - the non final value to use
    • setJarType

      public void setJarType(String type)
      Set the spec JAR type.
      Parameters:
      type - the JAR type to use
    • setMetadata

      public void setMetadata(Metadata mdata)
      Set metadata for this spec.
      Parameters:
      mdata - the metadata use
    • toString

      public String toString()
      Create a readable inline description of the spec.
      Overrides:
      toString in class Object
      Returns:
      the description as a string