Package org.glassfish.spec
Class Spec
- java.lang.Object
-
- org.glassfish.spec.Spec
-
public class Spec extends java.lang.ObjectThe API specification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpec.JarTypeThe different kind of Spec Jar files.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPI_SUFFIXArtifactId suffix for Spec withapiJarType.private java.lang.StringapiPackageThe Spec API Package.private ArtifactartifactThe Spec Artifact.private java.util.List<java.lang.String>errorsThe errors during spec verification.private java.lang.StringimplBuildThe Spec Implementation Builder Number.private java.lang.StringimplNamespaceThe Spec Implementation Namespace.private java.lang.StringimplVersionThe Spec Implementation Version.static java.lang.StringJAKARTA_GROUP_IDGroupId used for JakartaEE specs.private java.util.jar.JarFilejarThe Spec JAR file.private Spec.JarTypejarTypeThe Spec Jar Type seeSpec.JarType.static java.lang.StringJAVAX_GROUP_IDGroupId used for JavaEE specs.private static java.lang.StringJCP_VERSION_RULEConstant for JCP Version Rule.private MetadatametadataThe Spec Artifact Metadata.private java.lang.StringnewImplVersionThe Spec Implementation Version.private java.lang.StringnewSpecVersionThe new Spec Version (for non final API).private booleannonFinalThe Spec Final flag.private static java.lang.StringNONFINAL_BUILD_SEPARATORConstant for Non Final API Build Separator.private static java.lang.StringNONFINAL_BUILD_SEPARATOR_SPECConstant for Non Final API Build Spec Separator.private java.lang.StringspecBuildThe Spec Build Number.private java.lang.StringspecImplVersionThe Spec Implementation Version.private SpecModespecModeThe Spec mode ("javaee"or"jakarta").private java.lang.StringspecVersionThe Spec Version.
-
Constructor Summary
Constructors Constructor Description Spec()Create a new instance ofSpec.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringbuildBundleSymbolicName()Build bundle symbolic name from API package and API_SUFFIX.private voidcheckClasses(java.util.jar.JarFile jarfile, java.lang.String... pkgs)Verify that the classes inside the given jarFile match the right package.ArtifactgetArtifact()Get the Spec Artifact.java.util.List<java.lang.String>getErrors()Get the errors collected during verification.MetadatagetMetadata()Get the Spec Metadata.voidread(java.util.jar.JarFile jarfile)Populate the spec artifact and metadata from the given JAR file.voidsetApiPackage(java.lang.String pkg)Set the API package for this spec.voidsetArtifact(Artifact a)Set the artifact for this spec.voidsetImplBuild(java.lang.String build)Set the implementation build for this spec.voidsetImplNamespace(java.lang.String namespace)Set the implementation namespace for this spec.voidsetImplVersion(java.lang.String version)Set the implementation version for this spec.voidsetJarType(java.lang.String type)Set the spec JAR type.voidsetMetadata(Metadata mdata)Set metadata for this spec.voidsetNewImplVersion(java.lang.String version)Set the new spec implementation version for this spec.voidsetNewSpecVersion(java.lang.String version)Set the new spec version for this spec.voidsetNonFinal(boolean nfinal)Set the spec non final flag.voidsetSpecBuild(java.lang.String build)Set the spec build for this spec.voidsetSpecImplVersion(java.lang.String version)Set the spec implementation version for this spec.voidsetSpecMode(java.lang.String name)Set spec mode value for this spec.voidsetSpecVersion(java.lang.String version)Set the spec version for this spec.java.lang.StringtoString()Create a readable inline description of the spec.voidverify()Perform the Spec verification.private voidverifyApiPackagePrefix()Verify that apiPackage starts with proper prefix.
-
-
-
Field Detail
-
JAVAX_GROUP_ID
public static final java.lang.String JAVAX_GROUP_ID
GroupId used for JavaEE specs.- See Also:
- Constant Field Values
-
JAKARTA_GROUP_ID
public static final java.lang.String JAKARTA_GROUP_ID
GroupId used for JakartaEE specs.- See Also:
- Constant Field Values
-
artifact
private Artifact artifact
The Spec Artifact.
-
metadata
private Metadata metadata
The Spec Artifact Metadata.
-
jar
private java.util.jar.JarFile jar
The Spec JAR file.
-
specMode
private SpecMode specMode
The Spec mode ("javaee"or"jakarta"). Default value isSpecMode.JAKARTA.
-
specVersion
private java.lang.String specVersion
The Spec Version.
-
newSpecVersion
private java.lang.String newSpecVersion
The new Spec Version (for non final API).
-
specImplVersion
private java.lang.String specImplVersion
The Spec Implementation Version.
-
implVersion
private java.lang.String implVersion
The Spec Implementation Version.
-
newImplVersion
private java.lang.String newImplVersion
The Spec Implementation Version.
-
specBuild
private java.lang.String specBuild
The Spec Build Number.
-
implBuild
private java.lang.String implBuild
The Spec Implementation Builder Number.
-
apiPackage
private java.lang.String apiPackage
The Spec API Package.
-
implNamespace
private java.lang.String implNamespace
The Spec Implementation Namespace.
-
nonFinal
private boolean nonFinal
The Spec Final flag.
-
jarType
private Spec.JarType jarType
The Spec Jar Type seeSpec.JarType.
-
errors
private final java.util.List<java.lang.String> errors
The errors during spec verification.
-
NONFINAL_BUILD_SEPARATOR_SPEC
private static final java.lang.String NONFINAL_BUILD_SEPARATOR_SPEC
Constant for Non Final API Build Spec Separator.- See Also:
- Constant Field Values
-
NONFINAL_BUILD_SEPARATOR
private static final java.lang.String NONFINAL_BUILD_SEPARATOR
Constant for Non Final API Build Separator.- See Also:
- Constant Field Values
-
JCP_VERSION_RULE
private static final java.lang.String JCP_VERSION_RULE
Constant for JCP Version Rule.- See Also:
- Constant Field Values
-
API_SUFFIX
public static final java.lang.String API_SUFFIX
ArtifactId suffix for Spec withapiJarType.- See Also:
- Constant Field Values
-
-
Method Detail
-
read
public void read(java.util.jar.JarFile jarfile) throws java.io.IOExceptionPopulate the spec artifact and metadata from the given JAR file.- Parameters:
jarfile- the JAR file to process- Throws:
java.io.IOException- if an error occurs while reading the JAR file
-
checkClasses
private void checkClasses(java.util.jar.JarFile jarfile, java.lang.String... pkgs)Verify that the classes inside the given jarFile match the right package.- Parameters:
jarfile- the JAR file to processpkgs- 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 java.util.List<java.lang.String> getErrors()
Get the errors collected during verification.- Returns:
- the list of errors
-
setSpecMode
public void setSpecMode(java.lang.String name)
Set spec mode value for this spec.- Parameters:
name- spec mode value matching lower case value ofSpecModename attribute
-
setApiPackage
public void setApiPackage(java.lang.String pkg)
Set the API package for this spec.- Parameters:
pkg- the apiPackage to use
-
buildBundleSymbolicName
public java.lang.String buildBundleSymbolicName()
Build bundle symbolic name from API package and API_SUFFIX.- Returns:
- bundle symbolic name value to be supplied
as
spec.bundle.symbolic-nameproperty.
-
setImplNamespace
public void setImplNamespace(java.lang.String namespace)
Set the implementation namespace for this spec.- Parameters:
namespace- the implementation namespace
-
setImplVersion
public void setImplVersion(java.lang.String version)
Set the implementation version for this spec.- Parameters:
version- the implementation version
-
setSpecVersion
public void setSpecVersion(java.lang.String version)
Set the spec version for this spec.- Parameters:
version- the spec version
-
setNewImplVersion
public void setNewImplVersion(java.lang.String version)
Set the new spec implementation version for this spec.- Parameters:
version- the spec version
-
setSpecBuild
public void setSpecBuild(java.lang.String build)
Set the spec build for this spec.- Parameters:
build- the spec build
-
setSpecImplVersion
public void setSpecImplVersion(java.lang.String version)
Set the spec implementation version for this spec.- Parameters:
version- the spec implementation version
-
setNewSpecVersion
public void setNewSpecVersion(java.lang.String version)
Set the new spec version for this spec.- Parameters:
version- the new spec version
-
setImplBuild
public void setImplBuild(java.lang.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(java.lang.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 java.lang.String toString()
Create a readable inline description of the spec.- Overrides:
toStringin classjava.lang.Object- Returns:
- the description as a string
-
-