]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.api/src/org/argeo/slc/execution/RefSpecAttribute.java
Improve publishing third parties.
[gpl/argeo-slc.git] / org.argeo.slc.api / src / org / argeo / slc / execution / RefSpecAttribute.java
1 package org.argeo.slc.execution;
2
3 import java.util.List;
4
5 /** A spec attribute whose value is a reference to a full fledged object. */
6 public class RefSpecAttribute extends AbstractSpecAttribute implements
7 Cloneable {
8 private static final long serialVersionUID = -3427797452955753574L;
9 private transient Class<?> targetClass = String.class;
10 /** Read only. */
11 private String targetClassName;
12 private transient Object value = null;
13
14 /** List to be chosen from */
15 private List<RefValueChoice> choices = null;
16
17 public Object getValue() {
18 return value;
19 }
20
21 public void setValue(Object value) {
22 this.value = value;
23 }
24
25 /** Default is {@link String} */
26 public Class<?> getTargetClass() {
27 return targetClass;
28 }
29
30 public void setTargetClass(Class<?> targetClass) {
31 this.targetClass = targetClass;
32 this.targetClassName = targetClass.getName();
33 }
34
35 public String getTargetClassName() {
36 return targetClassName;
37 }
38
39 /** @return can be null */
40 public List<RefValueChoice> getChoices() {
41 return choices;
42 }
43
44 public void setChoices(List<RefValueChoice> choices) {
45 this.choices = choices;
46 }
47
48 @Override
49 protected Object clone() throws CloneNotSupportedException {
50 RefSpecAttribute rsa = new RefSpecAttribute();
51 rsa.setTargetClass(targetClass);
52 rsa.setChoices(choices);
53 return rsa;
54 }
55
56 @Override
57 public String toString() {
58 return "Ref spec attribute [" + targetClass + "]"
59 + (value != null ? "=" + value : "");
60 }
61
62 }