本文整理了Java中com.fasterxml.jackson.databind.JsonSerializer.usesObjectId()
方法的一些代码示例,展示了JsonSerializer.usesObjectId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSerializer.usesObjectId()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.JsonSerializer
类名称:JsonSerializer
方法名:usesObjectId
[英]Method that can be called to see whether this serializer instance will use Object Id to handle cyclic references.
[中]方法,以查看此序列化程序实例是否将使用对象Id来处理循环引用。
代码示例来源:origin: redisson/redisson
/**
* Method called to handle a direct self-reference through this property.
* Method can choose to indicate an error by throwing
* {@link JsonMappingException}; fully handle serialization (and return
* true); or indicate that it should be serialized normally (return false).
* <p>
* Default implementation will throw {@link JsonMappingException} if
* {@link SerializationFeature#FAIL_ON_SELF_REFERENCES} is enabled; or
* return <code>false</code> if it is disabled.
*
* @return True if method fully handled self-referential value; false if not
* (caller is to handle it) or {@link JsonMappingException} if there
* is no way handle it
*/
protected boolean _handleSelfReference(Object bean, JsonGenerator gen,
SerializerProvider prov, JsonSerializer<?> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer
// (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
prov.reportBadDefinition(getType(), "Direct self-reference leading to cycle");
}
}
return false;
}
代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-hibernate3
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: FasterXML/jackson-datatype-hibernate
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: FasterXML/jackson-datatype-hibernate
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-hibernate5
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-hibernate4
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: FasterXML/jackson-datatype-hibernate
@Override
public boolean usesObjectId() {
return _serializer.usesObjectId();
}
代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind
protected void _handleSelfReference(Object bean, JsonSerializer<?> ser)
throws JsonMappingException
{
/* 05-Feb-2012, tatu: Usually a problem, but NOT if we are handling
* object id; this may be the case for BeanSerializers at least.
*/
if (ser.usesObjectId()) {
return;
}
throw new JsonMappingException("Direct self-reference leading to cycle");
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
protected void _handleSelfReference(Object bean, JsonSerializer<?> ser)
throws JsonMappingException
{
/* 05-Feb-2012, tatu: Usually a problem, but NOT if we are handling
* object id; this may be the case for BeanSerializers at least.
*/
if (ser.usesObjectId()) {
return;
}
throw new JsonMappingException("Direct self-reference leading to cycle");
}
代码示例来源:origin: sosoapi/framework
protected void _handleSelfReference(Object bean, JsonSerializer<?> ser)
throws JsonMappingException
{
/* 05-Feb-2012, tatu: Usually a problem, but NOT if we are handling
* object id; this may be the case for BeanSerializers at least.
*/
if (ser.usesObjectId()) {
return;
}
throw new JsonMappingException("Direct self-reference leading to cycle");
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Method called to handle a direct self-reference through this property.
* Method can choose to indicate an error by throwing {@link JsonMappingException};
* fully handle serialization (and return true); or indicate that it should be
* serialized normally (return false).
*<p>
* Default implementation will throw {@link JsonMappingException} if
* {@link SerializationFeature#FAIL_ON_SELF_REFERENCES} is enabled;
* or return <code>false</code> if it is disabled.
*
* @return True if method fully handled self-referential value; false if not (caller
* is to handle it) or {@link JsonMappingException} if there is no way handle it
*/
protected boolean _handleSelfReference(Object bean, JsonGenerator gen, SerializerProvider prov, JsonSerializer<?> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
throw new JsonMappingException("Direct self-reference leading to cycle");
}
}
return false;
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Method called to handle a direct self-reference through this property.
* Method can choose to indicate an error by throwing {@link JsonMappingException};
* fully handle serialization (and return true); or indicate that it should be
* serialized normally (return false).
*<p>
* Default implementation will throw {@link JsonMappingException} if
* {@link SerializationFeature#FAIL_ON_SELF_REFERENCES} is enabled;
* or return <code>false</code> if it is disabled.
*
* @return True if method fully handled self-referential value; false if not (caller
* is to handle it) or {@link JsonMappingException} if there is no way handle it
*/
protected boolean _handleSelfReference(Object bean, JsonGenerator gen, SerializerProvider prov, JsonSerializer<?> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
throw new JsonMappingException("Direct self-reference leading to cycle");
}
}
return false;
}
代码示例来源:origin: Nextdoor/bender
/**
* Method called to handle a direct self-reference through this property.
* Method can choose to indicate an error by throwing
* {@link JsonMappingException}; fully handle serialization (and return
* true); or indicate that it should be serialized normally (return false).
* <p>
* Default implementation will throw {@link JsonMappingException} if
* {@link SerializationFeature#FAIL_ON_SELF_REFERENCES} is enabled; or
* return <code>false</code> if it is disabled.
*
* @return True if method fully handled self-referential value; false if not
* (caller is to handle it) or {@link JsonMappingException} if there
* is no way handle it
*/
protected boolean _handleSelfReference(Object bean, JsonGenerator gen,
SerializerProvider prov, JsonSerializer<?> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer
// (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
prov.reportMappingProblem("Direct self-reference leading to cycle");
}
}
return false;
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
/**
* Method called to handle a direct self-reference through this property.
* Method can choose to indicate an error by throwing
* {@link JsonMappingException}; fully handle serialization (and return
* true); or indicate that it should be serialized normally (return false).
* <p>
* Default implementation will throw {@link JsonMappingException} if
* {@link SerializationFeature#FAIL_ON_SELF_REFERENCES} is enabled; or
* return <code>false</code> if it is disabled.
*
* @return True if method fully handled self-referential value; false if not
* (caller is to handle it) or {@link JsonMappingException} if there
* is no way handle it
*/
protected boolean _handleSelfReference(Object bean, JsonGenerator gen,
SerializerProvider prov, JsonSerializer<?> ser)
throws JsonMappingException {
if (prov.isEnabled(SerializationFeature.FAIL_ON_SELF_REFERENCES)
&& !ser.usesObjectId()) {
// 05-Feb-2013, tatu: Usually a problem, but NOT if we are handling
// object id; this may be the case for BeanSerializers at least.
// 13-Feb-2014, tatu: another possible ok case: custom serializer
// (something
// OTHER than {@link BeanSerializerBase}
if (ser instanceof BeanSerializerBase) {
prov.reportBadDefinition(getType(), "Direct self-reference leading to cycle");
}
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!