com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor.
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: MonetaryAmountSerializer.java From jackson-datatype-money with MIT License | 6 votes |
@Override public void acceptJsonFormatVisitor(final JsonFormatVisitorWrapper wrapper, final JavaType hint) throws JsonMappingException { @Nullable final JsonObjectFormatVisitor visitor = wrapper.expectObjectFormat(hint); if (visitor == null) { return; } final SerializerProvider provider = wrapper.getProvider(); visitor.property(names.getAmount(), provider.findValueSerializer(writer.getType()), provider.constructType(writer.getType())); visitor.property(names.getCurrency(), provider.findValueSerializer(CurrencyUnit.class), provider.constructType(CurrencyUnit.class)); visitor.optionalProperty(names.getFormatted(), provider.findValueSerializer(String.class), provider.constructType(String.class)); }
Example #2
Source File: RangeSerializer.java From jackson-datatypes-collections with Apache License 2.0 | 6 votes |
@Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { if (visitor != null) { JsonObjectFormatVisitor objectVisitor = visitor.expectObjectFormat(typeHint); if (objectVisitor != null) { if (_endpointSerializer != null) { JavaType endpointType = _rangeType.containedType(0); JavaType btType = visitor.getProvider().constructType(BoundType.class); // should probably keep track of `property`... JsonSerializer<?> btSer = visitor.getProvider() .findContentValueSerializer(btType, null); objectVisitor.property(_fieldNames.lowerEndpoint, _endpointSerializer, endpointType); objectVisitor.property(_fieldNames.lowerBoundType, btSer, btType); objectVisitor.property(_fieldNames.upperEndpoint, _endpointSerializer, endpointType); objectVisitor.property(_fieldNames.upperBoundType, btSer, btType); } } } }
Example #3
Source File: UnwrappingBeanPropertyWriter.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public void depositSchemaProperty(final JsonObjectFormatVisitor visitor, SerializerProvider provider) throws JsonMappingException { JsonSerializer<Object> ser = provider .findValueSerializer(this.getType(), this) .unwrappingSerializer(_nameTransformer); if (ser.isUnwrappingSerializer()) { ser.acceptJsonFormatVisitor(new JsonFormatVisitorWrapper.Base(provider) { // an unwrapping serializer will always expect ObjectFormat, // hence, the other cases do not have to be implemented @Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) throws JsonMappingException { return visitor; } }, this.getType()); } else { super.depositSchemaProperty(visitor, provider); } }
Example #4
Source File: SimpleBeanPropertyFilter.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { if (include(writer)) { writer.depositSchemaProperty(objectVisitor, provider); } }
Example #5
Source File: JacksonObjectProvider.java From ameba with MIT License | 5 votes |
@Override public void depositSchemaProperty(final PropertyWriter writer, final JsonObjectFormatVisitor objectVisitor, final SerializerProvider provider) throws JsonMappingException { if (include(writer.getName())) { writer.depositSchemaProperty(objectVisitor, provider); } }
Example #6
Source File: FieldDocumentationVisitorWrapper.java From spring-auto-restdocs with Apache License 2.0 | 5 votes |
@Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) throws JsonMappingException { addFieldIfPresent("Object"); if (shouldExpand() && (topLevelPath() || !wasVisited(type))) { log.trace("({}) {} expanding", path, toString(type)); return new FieldDocumentationObjectVisitor(provider, context, path, withVisitedType(type), typeFactory, skipAccessor); } else { log.trace("({}) {} NOT expanding", path, toString(type)); return new JsonObjectFormatVisitor.Base(); } }
Example #7
Source File: CustomProtobufSchemaGenerator.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) { // from ProtobufSchemaGenerator _rootType = type; MessageElementVisitor visitor = new CustomMessageElementVisitor(_provider, type, _definedTypeElementBuilders, _isNested, customizedDataTypes); _builder = visitor; _definedTypeElementBuilders.addTypeElement(type, visitor, _isNested); return visitor; }
Example #8
Source File: CustomProtoBufSchemaVisitor.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) { // from ProtoBufSchemaVisitor MessageElementVisitor visitor = new CustomMessageElementVisitor(_provider, type, _definedTypeElementBuilders, _isNested, customizedDataTypes); _builder = visitor; _definedTypeElementBuilders.addTypeElement(type, visitor, _isNested); return visitor; }
Example #9
Source File: SettableBeanProperty.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { if (isRequired()) { objectVisitor.property(this); } else { objectVisitor.optionalProperty(this); } }
Example #10
Source File: FilteredBeanPropertyWriter.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializerProvider provider) throws JsonMappingException { if (_inView(provider.getActiveView())) { super.depositSchemaProperty(v, provider); } }
Example #11
Source File: FilteredBeanPropertyWriter.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializerProvider provider) throws JsonMappingException { Class<?> activeView = provider.getActiveView(); if (activeView == null || _view.isAssignableFrom(activeView)) { super.depositSchemaProperty(v, provider); } }
Example #12
Source File: SimpleBeanPropertyFilter.java From lams with GNU General Public License v2.0 | 5 votes |
@Deprecated @Override public void depositSchemaProperty(BeanPropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { if (include(writer)) { writer.depositSchemaProperty(objectVisitor, provider); } }
Example #13
Source File: BeanPropertyWriter.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializerProvider provider) throws JsonMappingException { if (v != null) { if (isRequired()) { v.property(this); } else { v.optionalProperty(this); } } }
Example #14
Source File: MapProperty.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { _property.depositSchemaProperty(objectVisitor, provider); }
Example #15
Source File: BeanSerializerBase.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { //deposit your output format if (visitor == null) { return; } JsonObjectFormatVisitor objectVisitor = visitor.expectObjectFormat(typeHint); if (objectVisitor == null) { return; } final SerializerProvider provider = visitor.getProvider(); if (_propertyFilterId != null) { PropertyFilter filter = findPropertyFilter(visitor.getProvider(), _propertyFilterId, null); for (int i = 0, end = _props.length; i < end; ++i) { filter.depositSchemaProperty(_props[i], objectVisitor, provider); } } else { Class<?> view = ((_filteredProps == null) || (provider == null)) ? null : provider.getActiveView(); final BeanPropertyWriter[] props; if (view != null) { props = _filteredProps; } else { props = _props; } for (int i = 0, end = props.length; i < end; ++i) { BeanPropertyWriter prop = props[i]; if (prop != null) { // may be filtered out unconditionally prop.depositSchemaProperty(objectVisitor, provider); } } } }
Example #16
Source File: PropertyWriter.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Traversal method used for things like JSON Schema generation, or * POJO introspection. */ @Override public abstract void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException;
Example #17
Source File: SentinelSecureFilter.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { writer.depositSchemaProperty(objectVisitor, provider); }
Example #18
Source File: BeanProperty.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException { }
Example #19
Source File: BeanProperty.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Method that can be called to visit the type structure that this * property is part of. * Note that not all implementations support traversal with this * method; those that do not should throw * {@link UnsupportedOperationException}. *<p> * NOTE: Starting with 2.7, takes explicit {@link SerializerProvider} * argument to reduce the need to rely on provider visitor may or may not * have assigned. * * @param objectVisitor Visitor to used as the callback handler * * @since 2.2 (although signature did change in 2.7) */ public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException;
Example #20
Source File: PropertyFilter.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Method called by {@link BeanSerializer} to let the filter determine whether, and in what * form the given property exist within the parent, or root, schema. Filters can omit * adding the property to the node, or choose the form of the schema value for the property *<p> * Typical implementation is something like: *<pre> * if (include(writer)) { * writer.depositSchemaProperty(objectVisitor, provider); * } *</pre> * * @param writer Bean property serializer to use to create schema value * @param objectVisitor JsonObjectFormatVisitor which should be aware of * the property's existence * @param provider Provider that can be used for accessing dynamic aspects of serialization * processing */ public void depositSchemaProperty(PropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException;
Example #21
Source File: BeanPropertyFilter.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Method called by {@link BeanSerializer} to let the filter determine whether, and in what * form the given property exist within the parent, or root, schema. Filters can omit * adding the property to the node, or choose the form of the schema value for the property *<p> * Typical implementation is something like: *<pre> * if (include(writer)) { * writer.depositSchemaProperty(objectVisitor, provider); * } *</pre> * * @param writer Bean property serializer to use to create schema value * @param objectVisitor JsonObjectFormatVisitor which should be aware of * the property's existence * @param provider Provider that can be used for accessing dynamic aspects of serialization * processing * * @since 2.1 */ public void depositSchemaProperty(BeanPropertyWriter writer, JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) throws JsonMappingException;
Example #22
Source File: BeanProperty.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Implementation of this method throws * {@link UnsupportedOperationException}, since instances of this * implementation should not be used as part of actual structure * visited. Rather, other implementations should handle it. */ @Override public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, SerializerProvider provider) { throw new UnsupportedOperationException("Instances of "+getClass().getName()+" should not get visited"); }