]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/PrimitiveSpecAttribute.java
1 package org
.argeo
.slc
.core
.execution
;
3 import org
.argeo
.slc
.SlcException
;
5 public class PrimitiveSpecAttribute
extends AbstractSpecAttribute
implements
11 public final static String TYPE_STRING
= "string";
12 public final static String TYPE_INTEGER
= "integer";
13 public final static String TYPE_LONG
= "long";
14 public final static String TYPE_FLOAT
= "float";
15 public final static String TYPE_DOUBLE
= "double";
16 public final static String TYPE_BOOLEAN
= "boolean";
18 private String type
= "string";
19 private Object value
= null;
21 public Object
getValue() {
25 public void setValue(Object value
) {
29 public String
getType() {
33 public Class
<?
> getTypeAsClass() {
34 return typeAsClass(type
);
37 public void setType(String type
) {
40 // check whether type is recognized.
41 // TODO: make validation cleaner
45 public static Class
<?
> typeAsClass(String type
) {
46 if (TYPE_STRING
.equals(type
))
48 else if (TYPE_INTEGER
.equals(type
))
50 else if (TYPE_LONG
.equals(type
))
52 else if (TYPE_FLOAT
.equals(type
))
54 else if (TYPE_DOUBLE
.equals(type
))
56 else if (TYPE_BOOLEAN
.equals(type
))
59 throw new SlcException("Unrecognized type " + type
);