Java Code Examples for org.nd4j.shade.jackson.databind.ObjectMapper#setVisibility()
The following examples show how to use
org.nd4j.shade.jackson.databind.ObjectMapper#setVisibility() .
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: Schema.java From DataVec with Apache License 2.0 | 6 votes |
private String toJacksonString(JsonFactory factory) { ObjectMapper om = new ObjectMapper(factory); om.registerModule(new JodaModule()); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); om.enable(SerializationFeature.INDENT_OUTPUT); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); String str; try { str = om.writeValueAsString(this); } catch (Exception e) { throw new RuntimeException(e); } return str; }
Example 2
Source File: Schema.java From deeplearning4j with Apache License 2.0 | 6 votes |
private String toJacksonString(JsonFactory factory) { ObjectMapper om = new ObjectMapper(factory); om.registerModule(new JodaModule()); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); om.enable(SerializationFeature.INDENT_OUTPUT); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); String str; try { str = om.writeValueAsString(this); } catch (Exception e) { throw new RuntimeException(e); } return str; }
Example 3
Source File: Schema.java From DataVec with Apache License 2.0 | 5 votes |
private static Schema fromJacksonString(String str, JsonFactory factory) { ObjectMapper om = new ObjectMapper(factory); om.registerModule(new JodaModule()); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); om.enable(SerializationFeature.INDENT_OUTPUT); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); try { return om.readValue(str, Schema.class); } catch (Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: JsonMappers.java From deeplearning4j with Apache License 2.0 | 5 votes |
private static void configureMapper(ObjectMapper ret) { ret.registerModule(new JodaModule()); ret.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); ret.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); ret.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); ret.enable(SerializationFeature.INDENT_OUTPUT); ret.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); ret.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); ret.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.ANY); //Need this otherwise JsonProperty annotations on constructors won't be seen }
Example 5
Source File: BaseTrainingMaster.java From deeplearning4j with Apache License 2.0 | 5 votes |
protected static ObjectMapper getNewMapper(JsonFactory jsonFactory) { ObjectMapper om = new ObjectMapper(jsonFactory); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); om.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); om.enable(SerializationFeature.INDENT_OUTPUT); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); return om; }
Example 6
Source File: JsonMapper.java From deeplearning4j with Apache License 2.0 | 5 votes |
private static ObjectMapper getMapper(){ ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); mapper.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.ANY); return mapper; }
Example 7
Source File: TestJson.java From deeplearning4j with Apache License 2.0 | 5 votes |
protected static ObjectMapper getObjectMapper(JsonFactory factory) { ObjectMapper om = new ObjectMapper(factory); om.registerModule(new JodaModule()); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); om.enable(SerializationFeature.INDENT_OUTPUT); om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); om.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); om.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.ANY); return om; }