File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import org .osgl .$ ;
77import org .osgl .http .H ;
88import org .osgl .logging .Logger ;
9- import org .osgl .mvc . util .StringValueResolver ;
9+ import org .osgl .util .StringValueResolver ;
1010import org .osgl .util .C ;
1111import org .osgl .util .E ;
1212import org .osgl .util .FastStr ;
Original file line number Diff line number Diff line change 1010import org .joda .time .LocalDate ;
1111import org .joda .time .LocalDateTime ;
1212import org .joda .time .LocalTime ;
13- import org .osgl .mvc . util .StringValueResolver ;
13+ import org .osgl .util .StringValueResolver ;
1414import org .osgl .util .C ;
1515import org .osgl .util .S ;
1616
Original file line number Diff line number Diff line change 33import act .conf .AppConfig ;
44import org .osgl .logging .L ;
55import org .osgl .logging .Logger ;
6- import org .osgl .mvc . util .StringValueResolver ;
6+ import org .osgl .util .StringValueResolver ;
77
88import javax .inject .Inject ;
99import javax .inject .Singleton ;
Original file line number Diff line number Diff line change 55import org .joda .time .format .DateTimeFormat ;
66import org .joda .time .format .DateTimeFormatter ;
77import org .joda .time .format .ISODateTimeFormat ;
8- import org .osgl .mvc . util .StringValueResolver ;
8+ import org .osgl .util .StringValueResolver ;
99import org .osgl .util .S ;
1010import org .osgl .util .ValueObject ;
1111
Original file line number Diff line number Diff line change 55import org .joda .time .format .DateTimeFormat ;
66import org .joda .time .format .DateTimeFormatter ;
77import org .joda .time .format .ISODateTimeFormat ;
8- import org .osgl .mvc . util .StringValueResolver ;
8+ import org .osgl .util .StringValueResolver ;
99import org .osgl .util .ValueObject ;
1010
1111public class JodaLocalDateCodec extends StringValueResolver <LocalDate > implements ValueObject .Codec <LocalDate > {
Original file line number Diff line number Diff line change 55import org .joda .time .format .DateTimeFormat ;
66import org .joda .time .format .DateTimeFormatter ;
77import org .joda .time .format .ISODateTimeFormat ;
8- import org .osgl .mvc . util .StringValueResolver ;
8+ import org .osgl .util .StringValueResolver ;
99import org .osgl .util .ValueObject ;
1010
1111public class JodaLocalDateTimeCodec extends StringValueResolver <LocalDateTime > implements ValueObject .Codec <LocalDateTime > {
Original file line number Diff line number Diff line change 55import org .joda .time .format .DateTimeFormat ;
66import org .joda .time .format .DateTimeFormatter ;
77import org .joda .time .format .ISODateTimeFormat ;
8- import org .osgl .mvc . util .StringValueResolver ;
8+ import org .osgl .util .StringValueResolver ;
99import org .osgl .util .ValueObject ;
1010
1111public class JodaLocalTimeCodec extends StringValueResolver <LocalTime > implements ValueObject .Codec <LocalTime > {
Original file line number Diff line number Diff line change 1+ package act .data ;
2+
3+ import com .alibaba .fastjson .JSON ;
4+ import com .alibaba .fastjson .JSONArray ;
5+ import org .osgl .$ ;
6+ import org .osgl .util .C ;
7+ import org .osgl .util .ValueObject ;
8+
9+ import java .util .List ;
10+
11+ public class ListCodec implements ValueObject .Codec <List <Object >> {
12+
13+ @ Override
14+ public Class <List <Object >> targetClass () {
15+ return $ .cast (List .class );
16+ }
17+
18+ @ Override
19+ public List <Object > parse (String s ) {
20+ JSONArray array = JSON .parseArray (s );
21+ List <Object > list = C .newSizedList (array .size ());
22+ for (Object o : array ) {
23+ list .add (ValueObject .of (o ));
24+ }
25+ return list ;
26+ }
27+
28+ @ Override
29+ public String toString (List <Object > o ) {
30+ return JSON .toJSONString (o );
31+ }
32+
33+ @ Override
34+ public String toJSONString (List <Object > o ) {
35+ return toString (o );
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ package act .data ;
2+
3+ import com .alibaba .fastjson .JSON ;
4+ import com .alibaba .fastjson .JSONObject ;
5+ import org .osgl .$ ;
6+ import org .osgl .util .C ;
7+ import org .osgl .util .ValueObject ;
8+
9+ import java .util .Map ;
10+
11+ public class MapCodec implements ValueObject .Codec <Map <String , Object >> {
12+ @ Override
13+ public Class <Map <String , Object >> targetClass () {
14+ return $ .cast (Map .class );
15+ }
16+
17+ @ Override
18+ public Map <String , Object > parse (String s ) {
19+ JSONObject json = JSON .parseObject (s );
20+ Map <String , Object > map = C .newMap ();
21+ for (Map .Entry <String , Object > entry : json .entrySet ()) {
22+ map .put (entry .getKey (), ValueObject .of (entry .getValue ()));
23+ }
24+ return map ;
25+ }
26+
27+ @ Override
28+ public String toString (Map <String , Object > o ) {
29+ return JSON .toJSONString (o );
30+ }
31+
32+ @ Override
33+ public String toJSONString (Map <String , Object > o ) {
34+ return toString (o );
35+ }
36+ }
Original file line number Diff line number Diff line change 11package act .data ;
22
33import act .plugin .Plugin ;
4- import org .osgl .mvc . util .StringValueResolver ;
4+ import org .osgl .util .StringValueResolver ;
55
66public abstract class StringValueResolverPlugin <T > extends StringValueResolver <T > implements Plugin {
77
You can’t perform that action at this time.
0 commit comments