org.bson.BSON.hasDecodeHooks()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.bson.BSON.hasDecodeHooks()方法的一些代码示例,展示了BSON.hasDecodeHooks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BSON.hasDecodeHooks()方法的具体详情如下:
包路径:org.bson.BSON
类名称:BSON
方法名:hasDecodeHooks

BSON.hasDecodeHooks介绍

[英]Gets whether any decoding transformers have been registered for any classes.
[中]

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

@Override
public Object objectDone() {
  BSONObject o = stack.removeLast();
  if (nameStack.size() > 0) {
    nameStack.removeLast();
  } else if (stack.size() > 0) {
    throw new IllegalStateException("Illegal object end in current context.");
  }
  return !BSON.hasDecodeHooks() ? o : (BSONObject) BSON.applyDecodingHooks(o);
}

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * Puts a new value into the document.
 *
 * @param name  the name of the field
 * @param value the value
 */
protected void _put(final String name, final Object value) {
  cur().put(name, !BSON.hasDecodeHooks() ? value : BSON.applyDecodingHooks(value));
}

代码示例来源:origin: org.mongodb/mongo-java-driver

/**
 * Transforms the {@code objectToDecode} using all transformers registered for the class of this object.
 *
 * @param objectToDecode the BSON object to decode
 * @return the transformed object
 */
public static Object applyDecodingHooks(final Object objectToDecode) {
  Object transformedObject = objectToDecode;
  if (!hasDecodeHooks() || objectToDecode == null || decodingHooks.size() == 0) {
    return transformedObject;
  }
  List<Transformer> transformersForObject = decodingHooks.get(objectToDecode.getClass());
  if (transformersForObject != null) {
    for (final Transformer transformer : transformersForObject) {
      transformedObject = transformer.transform(objectToDecode);
    }
  }
  return transformedObject;
}

代码示例来源:origin: spring-projects/spring-data-mongodb

private Object exceptionSwallowingStackReducingObjectDone/*CauseWeJustNeedTheStructureNotTheActualValue*/() {
    Object value;
    try {
      return super.objectDone();
    } catch (PatternSyntaxException e) {
      value = EMPTY_MARKER;
    }
    if (!isStackEmpty()) {
      _put(curName(), value);
    } else {
      value = !BSON.hasDecodeHooks() ? value : BSON.applyDecodingHooks(value);
      setRoot(value);
    }
    return value;
  }
}

代码示例来源:origin: org.mongodb/mongo-java-driver

_put(name, o);
} else {
  o = !org.bson.BSON.hasDecodeHooks() ? o : org.bson.BSON.applyDecodingHooks(o);
  setRoot(o);

代码示例来源:origin: org.springframework.data/spring-data-mongodb

private Object exceptionSwallowingStackReducingObjectDone/*CauseWeJustNeedTheStructureNotTheActualValue*/() {
    Object value;
    try {
      return super.objectDone();
    } catch (PatternSyntaxException e) {
      value = EMPTY_MARKER;
    }
    if (!isStackEmpty()) {
      _put(curName(), value);
    } else {
      value = !BSON.hasDecodeHooks() ? value : BSON.applyDecodingHooks(value);
      setRoot(value);
    }
    return value;
  }
}

代码示例来源:origin: com.sequoiadb/sequoiadb-driver

public Object objectDone() {
  final BSONObject o = _stack.removeLast();
  if (_nameStack.size() > 0)
    _nameStack.removeLast();
  else if (_stack.size() > 0) throw new IllegalStateException("something is wrong");
  return !BSON.hasDecodeHooks() ? o : (BSONObject) BSON.applyDecodingHooks(o);
}

代码示例来源:origin: com.sequoiadb/sequoiadb-driver

protected void _put(final String name, final Object o) {
  cur().put(name, !BSON.hasDecodeHooks() ? o : BSON.applyDecodingHooks(o));
}

代码示例来源:origin: org.mongodb/mongodb-driver

_put(name, o);
} else {
  o = !org.bson.BSON.hasDecodeHooks() ? o : org.bson.BSON.applyDecodingHooks(o);
  setRoot(o);

相关文章