This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git

commit 2406cae6115549233e434d15b4e80526cf466c11
Author: Stefan Bodewig <[email protected]>
AuthorDate: Sun May 17 15:00:27 2026 +0200

    make a few methods more accessible
---
 src/main/org/apache/ant/cyclonedx/Component.java   | 33 ++++++++++++++++++----
 .../org/apache/ant/cyclonedx/ComponentScope.java   |  2 +-
 .../org/apache/ant/cyclonedx/ComponentType.java    |  2 +-
 src/main/org/apache/ant/cyclonedx/EnumUtils.java   | 10 +++++--
 .../apache/ant/cyclonedx/ExternalReference.java    |  2 +-
 .../apache/ant/cyclonedx/ExternalReferenceSet.java |  2 +-
 src/main/org/apache/ant/cyclonedx/License.java     |  2 +-
 .../org/apache/ant/cyclonedx/Organization.java     |  2 +-
 8 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/src/main/org/apache/ant/cyclonedx/Component.java 
b/src/main/org/apache/ant/cyclonedx/Component.java
index 3a3cf62..3fe6758 100644
--- a/src/main/org/apache/ant/cyclonedx/Component.java
+++ b/src/main/org/apache/ant/cyclonedx/Component.java
@@ -454,6 +454,9 @@ public class Component extends DataType {
         return Collections.emptyList();
     }
 
+    /**
+     * Creates a new "file" type component for a resource.
+     */
     public static Component createFileComponent(Project project, Resource r) {
         Component c = new Component();
         c.setProject(project);
@@ -463,7 +466,10 @@ public class Component extends DataType {
         return c;
     }
 
-    org.cyclonedx.model.Component toMainCycloneDxComponent(Version bomVersion)
+    /**
+     * Translates this component to a CycloneDX component suitable for the 
metadata.component.
+     */
+    public org.cyclonedx.model.Component toMainCycloneDxComponent(Version 
bomVersion)
         throws IOException {
         if (isReference()) {
             return getRef().toMainCycloneDxComponent(bomVersion);
@@ -477,7 +483,10 @@ public class Component extends DataType {
         return toCycloneDxComponent(bomVersion);
     }
 
-    org.cyclonedx.model.Component toAdditionalCycloneDxComponent(Version 
bomVersion)
+    /**
+     * Translates this component to a CycloneDX component suitable for the 
components.component.
+     */
+    public org.cyclonedx.model.Component 
toAdditionalCycloneDxComponent(Version bomVersion)
         throws IOException {
         if (isReference()) {
             return getRef().toAdditionalCycloneDxComponent(bomVersion);
@@ -490,7 +499,10 @@ public class Component extends DataType {
         return component;
     }
 
-    private org.cyclonedx.model.Component toCycloneDxComponent(Version 
bomVersion)
+    /**
+     * Maps all common data except for <code>scope</scop> and 
<scope>isExternal</code>.
+     */
+    protected org.cyclonedx.model.Component toCycloneDxComponent(Version 
bomVersion)
         throws IOException {
         dieOnCircularReference();
         if (name == null) {
@@ -700,7 +712,12 @@ public class Component extends DataType {
         }
     }
 
-    private void addHashes(org.cyclonedx.model.Component component, Version 
bomVersion)
+    /**
+     * If this component has a nested resource child, all hashes
+     * supported by the CycloneDX Core library for the spec version are
+     * created and added to the given component.
+     */
+    protected void addHashes(org.cyclonedx.model.Component component, Version 
bomVersion)
         throws IOException {
         if (resource == null) {
             return;
@@ -766,6 +783,9 @@ public class Component extends DataType {
             this.componentRef = componentRef;
         }
 
+        /**
+         * Looks up the bom-ref of the dependency.
+         */
         public String getBomRef() {
             if (bomRef == null && componentRef == null) {
                 throw new BuildException("bomRef or componentRef is required");
@@ -809,7 +829,10 @@ public class Component extends DataType {
             tag = text;
         }
 
-        String getTag() {
+        /**
+         * Obtains the tag.
+         */
+        public String getTag() {
             return tag;
         }
     }
diff --git a/src/main/org/apache/ant/cyclonedx/ComponentScope.java 
b/src/main/org/apache/ant/cyclonedx/ComponentScope.java
index bd657f7..67ff30d 100644
--- a/src/main/org/apache/ant/cyclonedx/ComponentScope.java
+++ b/src/main/org/apache/ant/cyclonedx/ComponentScope.java
@@ -28,7 +28,7 @@ public class ComponentScope extends EnumeratedAttribute {
         return EnumUtils.valueOf(Scope.class, getValue(), Scope::getScopeName);
     }
 
-    static ComponentScope from(Scope scope) {
+    public static ComponentScope from(Scope scope) {
         ComponentScope s = new ComponentScope();
         s.setValue(scope.name());
         return s;
diff --git a/src/main/org/apache/ant/cyclonedx/ComponentType.java 
b/src/main/org/apache/ant/cyclonedx/ComponentType.java
index 02b1241..51c377b 100644
--- a/src/main/org/apache/ant/cyclonedx/ComponentType.java
+++ b/src/main/org/apache/ant/cyclonedx/ComponentType.java
@@ -28,7 +28,7 @@ public class ComponentType extends EnumeratedAttribute {
         return EnumUtils.valueOf(Type.class, getValue(), Type::getTypeName);
     }
 
-    static ComponentType from(Type type) {
+    public  static ComponentType from(Type type) {
         ComponentType t = new ComponentType();
         t.setValue(type.name());
         return t;
diff --git a/src/main/org/apache/ant/cyclonedx/EnumUtils.java 
b/src/main/org/apache/ant/cyclonedx/EnumUtils.java
index ea0a482..575454d 100644
--- a/src/main/org/apache/ant/cyclonedx/EnumUtils.java
+++ b/src/main/org/apache/ant/cyclonedx/EnumUtils.java
@@ -6,8 +6,12 @@ import java.util.stream.Stream;
 
 import org.apache.tools.ant.BuildException;
 
-class EnumUtils {
-    static <E extends Enum<E>> String[] valuesPlus(
+/**
+ * Helpers for the <code>EnumeratedAttribute<code>s wrapping enums in this 
package.
+ */
+public class EnumUtils {
+
+    public static <E extends Enum<E>> String[] valuesPlus(
         Class<E> clazz,
         Function<E, String> alternativeProvider) {
         return Arrays.stream(clazz.getEnumConstants())
@@ -15,7 +19,7 @@ class EnumUtils {
             .toArray(String[]::new);
     }
 
-    static <E extends Enum<E>> E valueOf(
+    public static <E extends Enum<E>> E valueOf(
         Class<E> clazz,
         String value,
         Function<E, String> alternativeProvider) throws BuildException {
diff --git a/src/main/org/apache/ant/cyclonedx/ExternalReference.java 
b/src/main/org/apache/ant/cyclonedx/ExternalReference.java
index 94f3d0d..81a1bf0 100644
--- a/src/main/org/apache/ant/cyclonedx/ExternalReference.java
+++ b/src/main/org/apache/ant/cyclonedx/ExternalReference.java
@@ -42,7 +42,7 @@ public class ExternalReference {
         this.type = type;
     }
 
-    org.cyclonedx.model.ExternalReference toCycloneDxExternalReference() {
+    public org.cyclonedx.model.ExternalReference 
toCycloneDxExternalReference() {
         if (url == null) {
             throw new BuildException("external references must have an url");
         }
diff --git a/src/main/org/apache/ant/cyclonedx/ExternalReferenceSet.java 
b/src/main/org/apache/ant/cyclonedx/ExternalReferenceSet.java
index 0e264cc..da1715d 100644
--- a/src/main/org/apache/ant/cyclonedx/ExternalReferenceSet.java
+++ b/src/main/org/apache/ant/cyclonedx/ExternalReferenceSet.java
@@ -25,7 +25,7 @@ public class ExternalReferenceSet extends DataType {
         externalReferences.add(ref.toCycloneDxExternalReference());
     }
 
-    Collection<org.cyclonedx.model.ExternalReference> getExternalReferences() {
+    public Collection<org.cyclonedx.model.ExternalReference> 
getExternalReferences() {
         if (isReference()) {
             return getRef().getExternalReferences();
         }
diff --git a/src/main/org/apache/ant/cyclonedx/License.java 
b/src/main/org/apache/ant/cyclonedx/License.java
index 0e3ebdc..0e29d91 100644
--- a/src/main/org/apache/ant/cyclonedx/License.java
+++ b/src/main/org/apache/ant/cyclonedx/License.java
@@ -58,7 +58,7 @@ public class License extends DataType {
         this.url = url.getURL().toExternalForm();
     }
 
-    org.cyclonedx.model.License toCycloneDxLicense() {
+    public org.cyclonedx.model.License toCycloneDxLicense() {
         if (isReference()) {
             return getRef().toCycloneDxLicense();
         }
diff --git a/src/main/org/apache/ant/cyclonedx/Organization.java 
b/src/main/org/apache/ant/cyclonedx/Organization.java
index 962ad80..8363b03 100644
--- a/src/main/org/apache/ant/cyclonedx/Organization.java
+++ b/src/main/org/apache/ant/cyclonedx/Organization.java
@@ -40,7 +40,7 @@ public class Organization extends DataType {
         urls.add(url.getURL().toExternalForm());
     }
 
-    OrganizationalEntity toOrganizationalEntity() {
+    public OrganizationalEntity toOrganizationalEntity() {
         if (isReference()) {
             return getRef().toOrganizationalEntity();
         }

Reply via email to