1
- /*
2
- * Copyright (c) 2014 Red Hat, Inc. and others
3
- *
4
- * Red Hat licenses this file to you under the Apache License, version 2.0
5
- * (the "License"); you may not use this file except in compliance with the
6
- * License. You may obtain a copy of the License at:
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- * License for the specific language governing permissions and limitations
14
- * under the License.
15
- */
16
-
17
1
package io .vertx .ext .shell .term ;
18
2
19
3
import io .vertx .core .json .JsonObject ;
20
4
import io .vertx .core .json .JsonArray ;
5
+ import java .time .Instant ;
6
+ import java .time .format .DateTimeFormatter ;
21
7
22
8
/**
23
9
* Converter for {@link io.vertx.ext.shell.term.HttpTermOptions}.
24
- *
25
10
* NOTE: This class has been automatically generated from the {@link io.vertx.ext.shell.term.HttpTermOptions} original class using Vert.x codegen.
26
11
*/
27
12
public class HttpTermOptionsConverter {
28
13
29
- public static void fromJson (JsonObject json , HttpTermOptions obj ) {
30
- if (json .getValue ("charset" ) instanceof String ) {
31
- obj .setCharset ((String )json .getValue ("charset" ));
32
- }
33
- if (json .getValue ("intputrc" ) instanceof String ) {
34
- obj .setIntputrc ((String )json .getValue ("intputrc" ));
35
- }
36
- if (json .getValue ("shellHtmlResource" ) instanceof String ) {
37
- obj .setShellHtmlResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )json .getValue ("shellHtmlResource" ))));
38
- }
39
- if (json .getValue ("sockJSHandlerOptions" ) instanceof JsonObject ) {
40
- obj .setSockJSHandlerOptions (new io .vertx .ext .web .handler .sockjs .SockJSHandlerOptions ((JsonObject )json .getValue ("sockJSHandlerOptions" )));
41
- }
42
- if (json .getValue ("sockJSPath" ) instanceof String ) {
43
- obj .setSockJSPath ((String )json .getValue ("sockJSPath" ));
44
- }
45
- if (json .getValue ("termJsResource" ) instanceof String ) {
46
- obj .setTermJsResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )json .getValue ("termJsResource" ))));
47
- }
48
- if (json .getValue ("vertsShellJsResource" ) instanceof String ) {
49
- obj .setVertsShellJsResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )json .getValue ("vertsShellJsResource" ))));
14
+ public static void fromJson (Iterable <java .util .Map .Entry <String , Object >> json , HttpTermOptions obj ) {
15
+ for (java .util .Map .Entry <String , Object > member : json ) {
16
+ switch (member .getKey ()) {
17
+ case "authOptions" :
18
+ break ;
19
+ case "charset" :
20
+ if (member .getValue () instanceof String ) {
21
+ obj .setCharset ((String )member .getValue ());
22
+ }
23
+ break ;
24
+ case "intputrc" :
25
+ if (member .getValue () instanceof String ) {
26
+ obj .setIntputrc ((String )member .getValue ());
27
+ }
28
+ break ;
29
+ case "shellHtmlResource" :
30
+ if (member .getValue () instanceof String ) {
31
+ obj .setShellHtmlResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )member .getValue ())));
32
+ }
33
+ break ;
34
+ case "sockJSHandlerOptions" :
35
+ if (member .getValue () instanceof JsonObject ) {
36
+ obj .setSockJSHandlerOptions (new io .vertx .ext .web .handler .sockjs .SockJSHandlerOptions ((JsonObject )member .getValue ()));
37
+ }
38
+ break ;
39
+ case "sockJSPath" :
40
+ if (member .getValue () instanceof String ) {
41
+ obj .setSockJSPath ((String )member .getValue ());
42
+ }
43
+ break ;
44
+ case "termJsResource" :
45
+ if (member .getValue () instanceof String ) {
46
+ obj .setTermJsResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )member .getValue ())));
47
+ }
48
+ break ;
49
+ case "vertsShellJsResource" :
50
+ if (member .getValue () instanceof String ) {
51
+ obj .setVertsShellJsResource (io .vertx .core .buffer .Buffer .buffer (java .util .Base64 .getDecoder ().decode ((String )member .getValue ())));
52
+ }
53
+ break ;
54
+ }
50
55
}
51
56
}
52
57
53
58
public static void toJson (HttpTermOptions obj , JsonObject json ) {
59
+ toJson (obj , json .getMap ());
60
+ }
61
+
62
+ public static void toJson (HttpTermOptions obj , java .util .Map <String , Object > json ) {
54
63
if (obj .getCharset () != null ) {
55
64
json .put ("charset" , obj .getCharset ());
56
65
}
57
66
if (obj .getIntputrc () != null ) {
58
67
json .put ("intputrc" , obj .getIntputrc ());
59
68
}
60
69
if (obj .getShellHtmlResource () != null ) {
61
- json .put ("shellHtmlResource" , obj .getShellHtmlResource ().getBytes ());
70
+ json .put ("shellHtmlResource" , java . util . Base64 . getEncoder (). encodeToString ( obj .getShellHtmlResource ().getBytes () ));
62
71
}
63
72
if (obj .getSockJSPath () != null ) {
64
73
json .put ("sockJSPath" , obj .getSockJSPath ());
65
74
}
66
75
if (obj .getTermJsResource () != null ) {
67
- json .put ("termJsResource" , obj .getTermJsResource ().getBytes ());
76
+ json .put ("termJsResource" , java . util . Base64 . getEncoder (). encodeToString ( obj .getTermJsResource ().getBytes () ));
68
77
}
69
78
if (obj .getVertsShellJsResource () != null ) {
70
- json .put ("vertsShellJsResource" , obj .getVertsShellJsResource ().getBytes ());
79
+ json .put ("vertsShellJsResource" , java . util . Base64 . getEncoder (). encodeToString ( obj .getVertsShellJsResource ().getBytes () ));
71
80
}
72
81
}
73
- }
82
+ }
0 commit comments