Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
1.0 KB
|
Line | |
---|
1 | package com.framsticks.params.types; |
---|
2 | |
---|
3 | import com.framsticks.params.CastFailure; |
---|
4 | import com.framsticks.params.ParamBuilder; |
---|
5 | import com.framsticks.params.ParamsUtil; |
---|
6 | import com.framsticks.params.PrimitiveParam; |
---|
7 | import com.framsticks.params.ReassignResult; |
---|
8 | |
---|
9 | import javax.annotation.concurrent.Immutable; |
---|
10 | |
---|
11 | /** |
---|
12 | * @author Piotr Sniegowski |
---|
13 | */ |
---|
14 | @Immutable |
---|
15 | public class UniversalParam extends PrimitiveParam<Object> { |
---|
16 | |
---|
17 | |
---|
18 | /** |
---|
19 | * @param builder |
---|
20 | */ |
---|
21 | public UniversalParam(ParamBuilder builder) { |
---|
22 | super(builder); |
---|
23 | } |
---|
24 | |
---|
25 | @Override |
---|
26 | public Class<?> getStorageType() { |
---|
27 | return Object.class; |
---|
28 | } |
---|
29 | |
---|
30 | @Override |
---|
31 | public String getFramsTypeName() { |
---|
32 | return "x"; |
---|
33 | } |
---|
34 | |
---|
35 | @Override |
---|
36 | public ReassignResult<Object> reassign(Object newValue, Object oldValue) throws CastFailure { |
---|
37 | if (newValue instanceof String) { |
---|
38 | return ReassignResult.create(ParamsUtil.deserialize((String) newValue, Object.class)); |
---|
39 | } |
---|
40 | return ReassignResult.create(newValue); |
---|
41 | } |
---|
42 | |
---|
43 | @Override |
---|
44 | public <T> String serialize(T value) { |
---|
45 | return ParamsUtil.serialize(value); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.