2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
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.
17 package org
.argeo
.slc
.core
.execution
;
19 import java
.util
.List
;
21 /** A spec attribute whose value is a reference to a full fledged object. */
22 public class RefSpecAttribute
extends AbstractSpecAttribute
implements
24 private static final long serialVersionUID
= -3427797452955753574L;
25 private transient Class
<?
> targetClass
= String
.class;
27 private String targetClassName
;
28 private transient Object value
= null;
30 /** List to be chosen from */
31 private List
<RefValueChoice
> choices
= null;
33 public Object
getValue() {
37 public void setValue(Object value
) {
41 /** Default is {@link String} */
42 public Class
<?
> getTargetClass() {
46 public void setTargetClass(Class
<?
> targetClass
) {
47 this.targetClass
= targetClass
;
48 this.targetClassName
= targetClass
.getName();
51 public String
getTargetClassName() {
52 return targetClassName
;
55 /** @return can be null */
56 public List
<RefValueChoice
> getChoices() {
60 public void setChoices(List
<RefValueChoice
> choices
) {
61 this.choices
= choices
;
65 protected Object
clone() throws CloneNotSupportedException
{
66 RefSpecAttribute rsa
= new RefSpecAttribute();
67 rsa
.setTargetClass(targetClass
);
68 rsa
.setChoices(choices
);
73 public String
toString() {
74 return "Ref spec attribute [" + targetClass
+ "]"
75 + (value
!= null ?
"=" + value
: "");