View Javadoc
1   package org.synchronoss.cpo.core.meta.domain;
2   
3   /*-
4    * [[
5    * core
6    * ==
7    * Copyright (C) 2003 - 2026 Exaxis LLC, Synchronoss Technologies Inc
8    * ==
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ]]
23   */
24  
25  import org.synchronoss.cpo.core.meta.bean.CpoClassBean;
26  
27  /**
28   * Represents a single bound argument of a {@link CpoFunction}: a reference to the {@link
29   * CpoAttribute} whose value is supplied for one of the function's bind markers. Setting the
30   * attribute also takes this argument's {@link #getName() name} from the attribute's Java name.
31   *
32   * @author dberry
33   */
34  public class CpoArgument extends CpoClassBean {
35  
36    private static final long serialVersionUID = 1L;
37  
38    /** The attribute bound to this argument. */
39    CpoAttribute attribute = null;
40  
41    /** Creates an empty instance. */
42    public CpoArgument() {}
43  
44    /**
45     * Gets the attribute bound to this argument.
46     *
47     * @return the bound attribute
48     */
49    public CpoAttribute getAttribute() {
50      return attribute;
51    }
52  
53    /**
54     * Sets the attribute bound to this argument, and updates this argument's name to match the
55     * attribute's Java name.
56     *
57     * @param attribute the attribute to bind
58     */
59    public void setAttribute(CpoAttribute attribute) {
60      this.attribute = attribute;
61      if (attribute != null) setName(attribute.getJavaName());
62    }
63  
64    /**
65     * {@inheritDoc}
66     *
67     * <p>Returns this argument's {@link #getDescription() description}.
68     */
69    @Override
70    public String toString() {
71      return this.getDescription();
72    }
73  
74    /**
75     * Gets the full field-by-field string representation of this argument, as produced by {@link
76     * CpoClassBean#toString()}.
77     *
78     * @return the full string representation
79     */
80    public String toStringFull() {
81      return super.toString();
82    }
83  }