com.fasterxml.jackson.databind.node.BooleanNode#FALSE源码实例Demo

下面列出了com.fasterxml.jackson.databind.node.BooleanNode#FALSE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Preparation Step: create a node for a schema representing the given method's associated return type.
 *
 * @param method method to populate the schema node for
 * @param isNullable whether the method's return value may be null
 * @param forceInlineDefinition whether to generate an inline definition without registering it in this context
 * @param ignoredDefinitionProvider first custom definition provider to ignore
 * @return schema node representing the given method's return type
 */
private JsonNode createMethodSchema(MethodScope method, boolean isNullable, boolean forceInlineDefinition,
        CustomPropertyDefinitionProvider<MethodScope> ignoredDefinitionProvider) {
    if (method.isVoid()) {
        return BooleanNode.FALSE;
    }
    ObjectNode subSchema = this.generatorConfig.createObjectNode();
    ObjectNode methodAttributes = AttributeCollector.collectMethodAttributes(method, this);
    this.populateMemberSchema(method, subSchema, isNullable, forceInlineDefinition, methodAttributes, ignoredDefinitionProvider);
    return subSchema;
}
 
源代码2 项目: jslt   文件: BuiltinFunctions.java
public JsonNode call(JsonNode input, JsonNode[] arguments) {
  // if data is missing then it doesn't match, end of story
  if (arguments[0].isNull())
    return BooleanNode.FALSE;

  String string = NodeUtils.toString(arguments[0], false);
  String regexp = NodeUtils.toString(arguments[1], true);
  if (regexp == null)
    throw new JsltException("test() can't test null regexp");

  Pattern p = getRegexp(regexp);
  java.util.regex.Matcher m = p.matcher(string);
  return NodeUtils.toJson(m.find(0));
}
 
源代码3 项目: jslt   文件: BuiltinFunctions.java
public JsonNode call(JsonNode input, JsonNode[] arguments) {
  JsonNode value = arguments[0];
  if (value.isNull())
    return value;
  else if (!value.isArray())
    throw new JsltException("all() requires an array, not " + value);

  for (int ix = 0; ix < value.size(); ix++) {
    JsonNode node = value.get(ix);
    if (!NodeUtils.isTrue(node))
      return BooleanNode.FALSE;
  }
  return BooleanNode.TRUE;
}
 
源代码4 项目: jslt   文件: BuiltinFunctions.java
public JsonNode call(JsonNode input, JsonNode[] arguments) {
  JsonNode value = arguments[0];
  if (value.isNull())
    return value;
  else if (!value.isArray())
    throw new JsltException("any() requires an array, not " + value);

  for (int ix = 0; ix < value.size(); ix++) {
    JsonNode node = value.get(ix);
    if (NodeUtils.isTrue(node))
      return BooleanNode.TRUE;
  }
  return BooleanNode.FALSE;
}
 
源代码5 项目: jslt   文件: BuiltinFunctions.java
public JsonNode call(JsonNode input, JsonNode[] arguments) {
  if (arguments[1].isNull())
    return BooleanNode.FALSE; // nothing is contained in null

  else if (arguments[1].isArray()) {
    for (int ix = 0; ix < arguments[1].size(); ix++)
      if (arguments[1].get(ix).equals(arguments[0]))
        return BooleanNode.TRUE;

  } else if (arguments[1].isObject()) {
    String key = NodeUtils.toString(arguments[0], true);
    if (key == null)
      return BooleanNode.FALSE;

    return NodeUtils.toJson(arguments[1].has(key));

  } else if (arguments[1].isTextual()) {
    String sub = NodeUtils.toString(arguments[0], true);
    if (sub == null)
      return BooleanNode.FALSE;

    String str = arguments[1].asText();
    return NodeUtils.toJson(str.indexOf(sub) != -1);

  } else
    throw new JsltException("Contains cannot operate on " + arguments[1]);

  return BooleanNode.FALSE;
}
 
源代码6 项目: jslt   文件: AndOperator.java
public JsonNode apply(Scope scope, JsonNode input) {
  boolean v1 = NodeUtils.isTrue(left.apply(scope, input));
  if (!v1)
    return BooleanNode.FALSE;

  boolean v2 = NodeUtils.isTrue(right.apply(scope, input));
  return NodeUtils.toJson(v1 && v2);
}
 
源代码7 项目: jslt   文件: NodeUtils.java
public static boolean isTrue(JsonNode value) {
  return value != BooleanNode.FALSE &&
    !(value.isObject() && value.size() == 0) &&
    !(value.isTextual() && value.asText().length() == 0) &&
    !(value.isArray() && value.size() == 0) &&
    !(value.isNumber() && value.doubleValue() == 0.0) &&
    !value.isNull();
}
 
源代码8 项目: jslt   文件: FunctionWrapper.java
public JsonNode convert(Object node) {
  if (node == null)
    return NullNode.instance;
  else if ((Boolean) node)
    return BooleanNode.TRUE;
  else
    return BooleanNode.FALSE;
}
 
源代码9 项目: graphql-spqr   文件: JacksonScalars.java
@Override
public BooleanNode parseValue(Object input) {
    if (input instanceof Boolean) {
        return (Boolean) input ? BooleanNode.TRUE : BooleanNode.FALSE;
    }
    if (input instanceof BooleanNode) {
        return (BooleanNode) input;
    }
    throw valueParsingException(input, Boolean.class, BooleanNode.class);
}
 
源代码10 项目: rest-schemagen   文件: BooleanJsonPropertyMapper.java
@Override
public ObjectNode toJson(JsonProperty jsonProperty) {
    Function<Object,JsonNode> nodeCreator = value -> ((Boolean) value) ? BooleanNode.TRUE
            : BooleanNode.FALSE;
    return primitiveJsonPropertyBuilder.forProperty(jsonProperty)
            .withType("boolean")
            .withDefaultValue(BooleanNode.FALSE)
            .withDefaultAndAllowedValues(nodeCreator).build();
}
 
源代码11 项目: jslt   文件: OptimizedStaticContainsFunction.java
public JsonNode call(JsonNode input, JsonNode[] arguments) {
  if (values.contains(arguments[0]))
    return BooleanNode.TRUE;
  else
    return BooleanNode.FALSE;
}
 
源代码12 项目: jslt   文件: NodeUtils.java
public static JsonNode toJson(boolean value) {
  if (value)
    return BooleanNode.TRUE;
  else
    return BooleanNode.FALSE;
}
 
源代码13 项目: graphql-spqr   文件: JacksonScalars.java
@Override
public BooleanNode parseLiteral(Object input) {
    return literalOrException(input, BooleanValue.class).isValue() ? BooleanNode.TRUE : BooleanNode.FALSE;
}