// Path: src/main/java/com/labs64/utils/swid/support/JAXBUtils.java
// public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(final Date date) {
//     try {
//         GregorianCalendar cal = new GregorianCalendar();
//         cal.setTime(date);
//         XMLGregorianCalendar calXml = DatatypeFactory.newInstance().newXMLGregorianCalendar(
//                 cal.get(Calendar.YEAR),
//                 cal.get(Calendar.MONTH) + 1,
//                 cal.get(Calendar.DAY_OF_MONTH),
//                 cal.get(Calendar.HOUR_OF_DAY),
//                 cal.get(Calendar.MINUTE),
//                 cal.get(Calendar.SECOND),
//                 cal.get(Calendar.MILLISECOND),
//                 0);
//         return calXml;
//     } catch (DatatypeConfigurationException e) {
//         throw new SwidException("Cannot convert date", e);
//     }
// }


import org.iso.standards.iso._19770.__2._2014_dis.schema.Directory;
import org.iso.standards.iso._19770.__2._2014_dis.schema.Evidence;
import org.iso.standards.iso._19770.__2._2014_dis.schema.File;
import org.iso.standards.iso._19770.__2._2014_dis.schema.Meta;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Date;
import java.util.List;
import static com.labs64.utils.swid.support.JAXBUtils.convertDateToXMLGregorianCalendar;
package com.labs64.utils.swid.builder;




public class EvidenceBuilder extends BaseElementBuilder<Evidence, EvidenceBuilder> {

    /**
     * adds a {@link Directory}, {@link File} or {@link Process} object.
     *
     * @param directoryOrFileOrProcess
     * @return reference to this object
     */
    public EvidenceBuilder directoryOrFileOrProcess(Meta directoryOrFileOrProcess) {
        item.getDirectoryOrFileOrProcess().add(directoryOrFileOrProcess);
        return this;
    }

    /**
     * adds a list of {@link Directory}, {@link File} and {@link Process} objects.
     *
     * @param directoryOrFileOrProcess
     * @return reference to this object
     */
    public EvidenceBuilder directoryOrFileOrProcess(List<Meta> directoryOrFileOrProcess) {
        if (directoryOrFileOrProcess != null) {
            item.getDirectoryOrFileOrProcess().addAll(directoryOrFileOrProcess);
        }
        return this;
    }

    /**
     * Sets the value of the date property.
     *
     * @param date
     *     allowed object is
     *     {@link Date }
     *
     */
    public EvidenceBuilder date(Date date) {
// Path: src/main/java/com/labs64/utils/swid/support/JAXBUtils.java
// public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(final Date date) {
//     try {
//         GregorianCalendar cal = new GregorianCalendar();
//         cal.setTime(date);
//         XMLGregorianCalendar calXml = DatatypeFactory.newInstance().newXMLGregorianCalendar(
//                 cal.get(Calendar.YEAR),
//                 cal.get(Calendar.MONTH) + 1,
//                 cal.get(Calendar.DAY_OF_MONTH),
//                 cal.get(Calendar.HOUR_OF_DAY),
//                 cal.get(Calendar.MINUTE),
//                 cal.get(Calendar.SECOND),
//                 cal.get(Calendar.MILLISECOND),
//                 0);
//         return calXml;
//     } catch (DatatypeConfigurationException e) {
//         throw new SwidException("Cannot convert date", e);
//     }
// }


// Path: src/main/java/com/labs64/utils/swid/builder/EvidenceBuilder.java
import org.iso.standards.iso._19770.__2._2014_dis.schema.Directory;
import org.iso.standards.iso._19770.__2._2014_dis.schema.Evidence;
import org.iso.standards.iso._19770.__2._2014_dis.schema.File;
import org.iso.standards.iso._19770.__2._2014_dis.schema.Meta;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Date;
import java.util.List;
import static com.labs64.utils.swid.support.JAXBUtils.convertDateToXMLGregorianCalendar;

package com.labs64.utils.swid.builder;




public class EvidenceBuilder extends BaseElementBuilder<Evidence, EvidenceBuilder> {

    /**
     * adds a {@link Directory}, {@link File} or {@link Process} object.
     *
     * @param directoryOrFileOrProcess
     * @return reference to this object
     */
    public EvidenceBuilder directoryOrFileOrProcess(Meta directoryOrFileOrProcess) {
        item.getDirectoryOrFileOrProcess().add(directoryOrFileOrProcess);
        return this;
    }

    /**
     * adds a list of {@link Directory}, {@link File} and {@link Process} objects.
     *
     * @param directoryOrFileOrProcess
     * @return reference to this object
     */
    public EvidenceBuilder directoryOrFileOrProcess(List<Meta> directoryOrFileOrProcess) {
        if (directoryOrFileOrProcess != null) {
            item.getDirectoryOrFileOrProcess().addAll(directoryOrFileOrProcess);
        }
        return this;
    }

    /**
     * Sets the value of the date property.
     *
     * @param date
     *     allowed object is
     *     {@link Date }
     *
     */
    public EvidenceBuilder date(Date date) {
        return date(convertDateToXMLGregorianCalendar(date));