Use ComponentInfo to process version data

The ComponentInfo interface enables you to process version information.

With ComponentInfo you can:

  • Determine whether to create a new version.
  • Create a new version based on version properties you set before.
  • Get file information for a particular version.

After the ComponentInfo interface is initialized in the class definitions, you can use it for creating or identifying artifacts as follows.

Existing versions


// For get version by name
VersionInfo versionInfo = componentInfo.getVersionByName(versionName);     
// your logic here


// For all the existing versions
List<VersionInfo> existingVersions = 
  (componentInfo == null) ? null : componentInfo.getAllVersions();
if(existingVersions != null && existingVersions.size() > 0) {
    for(VersionInfo info : existingVersions) {
        // your logic here

Latest versions

// For latest versions
VersionInfo singleLatestVersion = 
  (componentInfo == null) ? null : componentInfo.getLatestVersion();
// your logic goes here.

For details, see the Javadoc and the provided example.

Back to top