Java Code Examples for javax.json.bind.Jsonb#close()
The following examples show how to use
javax.json.bind.Jsonb#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserView.java From javaee8-cookbook with Apache License 2.0 | 6 votes |
public void loadUser(){ long now = System.currentTimeMillis(); User user = new User(now, "User" + now, "user" + now + "@eldermoraes.com", Math.random(), new Date()); Jsonb jb = JsonbBuilder.create(); json = jb.toJson(user); try { jb.close(); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
Example 2
Source File: JsonBUser.java From javaee8-cookbook with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { User user = new User("Elder", "[email protected]"); Jsonb jb = JsonbBuilder.create(); String jsonUser = jb.toJson(user); User u = jb.fromJson(jsonUser, User.class); jb.close(); System.out.println("json: " + jsonUser); System.out.println("user: " + u); }
Example 3
Source File: JsonbFactory.java From component-runtime with Apache License 2.0 | 5 votes |
void destroyJsonb(@Disposes final Jsonb jsonb) { try { jsonb.close(); } catch (final Exception e) { log.error(e.getMessage(), e); } }
Example 4
Source File: JsonbProducer.java From component-runtime with Apache License 2.0 | 5 votes |
public void close(@Disposes final Jsonb jsonb) { try { jsonb.close(); } catch (final Exception e) { log.warn(e.getMessage(), e); } }
Example 5
Source File: JsonbProducer.java From tomee with Apache License 2.0 | 5 votes |
public void close(@Disposes final Jsonb jsonb) { try { jsonb.close(); } catch (final Exception e) { log.log(Level.WARNING, e.getMessage(), e); } }