//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2015.08.18 at 01:46:14 PM IST 
//
package io.github.jeddict.jpa.spec;

import io.github.jeddict.source.AnnotationExplorer;
import java.util.ArrayList;
import java.util.List;
import static java.util.stream.Collectors.toList;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;

/**
 *
 *
 * @Target({}) @Retention(RUNTIME) public @interface ConstructorResult { Class
 * targetClass(); ColumnResult[] columns(); }
 *
 *
 *
 * <p>
 * Java class for constructor-result complex type.
 *
 * <p>
 * The following schema fragment specifies the expected content contained within
 * this class.
 *
 * <pre>
 * &lt;complexType name="constructor-result">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="column" type="{http://xmlns.jcp.org/xml/ns/persistence/orm}column-result" maxOccurs="unbounded"/>
 *       &lt;/sequence>
 *       &lt;attribute name="target-class" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "constructor-result", propOrder = {
    "column"
})
public class ConstructorResult {

    @XmlElement(name = "cr", required = true)//(required = true)
    protected List<ColumnResult> column;
    @XmlAttribute(name = "tc", required = true)//(name = "target-class", required = true)
    protected String targetClass;

    public static ConstructorResult load(AnnotationExplorer annotation) {
        ConstructorResult constructorResult = new ConstructorResult();
        annotation.getClassName("targetClass").ifPresent(constructorResult::setTargetClass);
        constructorResult.column
                = annotation.getAnnotationList("columns")
                        .map(ColumnResult::load)
                        .collect(toList());
        return constructorResult;
    }

    /**
     * Gets the value of the column property.
     *
     * <p>
     * This accessor method returns a reference to the live list, not a
     * snapshot. Therefore any modification you make to the returned list will
     * be present inside the JAXB object. This is why there is not a
     * <CODE>set</CODE> method for the column property.
     *
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getColumn().add(newItem);
     * </pre>
     *
     *
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link ColumnResult }
     *
     *
     */
    public List<ColumnResult> getColumn() {
        if (column == null) {
            column = new ArrayList<>();
        }
        return this.column;
    }

    /**
     * Gets the value of the targetClass property.
     *
     * @return possible object is {@link String }
     *
     */
    public String getTargetClass() {
        return targetClass;
    }

    /**
     * Sets the value of the targetClass property.
     *
     * @param value allowed object is {@link String }
     *
     */
    public void setTargetClass(String value) {
        this.targetClass = value;
    }

}
