2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.core
.execution
;
18 import java
.util
.List
;
20 /** A spec attribute whose value is a reference to a full fledged object. */
21 public class RefSpecAttribute
extends AbstractSpecAttribute
implements
23 private static final long serialVersionUID
= -3427797452955753574L;
24 private transient Class
<?
> targetClass
= String
.class;
26 private String targetClassName
;
27 private transient Object value
= null;
29 /** List to be chosen from */
30 private List
<RefValueChoice
> choices
= null;
32 public Object
getValue() {
36 public void setValue(Object value
) {
40 /** Default is {@link String} */
41 public Class
<?
> getTargetClass() {
45 public void setTargetClass(Class
<?
> targetClass
) {
46 this.targetClass
= targetClass
;
47 this.targetClassName
= targetClass
.getName();
50 public String
getTargetClassName() {
51 return targetClassName
;
54 /** @return can be null */
55 public List
<RefValueChoice
> getChoices() {
59 public void setChoices(List
<RefValueChoice
> choices
) {
60 this.choices
= choices
;
64 protected Object
clone() throws CloneNotSupportedException
{
65 RefSpecAttribute rsa
= new RefSpecAttribute();
66 rsa
.setTargetClass(targetClass
);
67 rsa
.setChoices(choices
);
72 public String
toString() {
73 return "Ref spec attribute [" + targetClass
+ "]"
74 + (value
!= null ?
"=" + value
: "");