当前位置: 首页>>代码示例>>Java>>正文


Java JsonValue.TRUE属性代码示例

本文整理汇总了Java中javax.json.JsonValue.TRUE属性的典型用法代码示例。如果您正苦于以下问题:Java JsonValue.TRUE属性的具体用法?Java JsonValue.TRUE怎么用?Java JsonValue.TRUE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.json.JsonValue的用法示例。


在下文中一共展示了JsonValue.TRUE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

public void load(final Trie s) {
	try (InputStream in = Files.newInputStream(filePath);
	    BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
	    String line;
	    final Set<Fact> facts = new TreeSet<Fact>();
	    
	    while ((line = reader.readLine()) != null) {
	    	if (line.compareTo(" ") > 0) {
		    	try (JsonReader json = Json.createReader(new StringReader(line))) {
			    	final JsonObject o = json.readObject();
			    	final Fact f = new Fact(o, context);
			    	if (o.get("deleted") == JsonValue.TRUE) {
			    		facts.remove(f);
			    	} else {
			    		facts.add(f);
			    	}				    	
		    	}
	    	}
	    }
	    
	    facts.parallelStream().forEach((f) -> s.insertAll(f, context));
   		context.commit();			    	
	} catch (IOException e) {
	    throw new RuntimeException(e);
	}
}
 
开发者ID:moforw,项目名称:albaum,代码行数:26,代码来源:Log.java

示例2: deserialize

@Override
public JsonValue deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {
    final JsonParser.Event next = ((JsonbRiParser)parser).getLastEvent();
    switch (next) {
        case VALUE_TRUE:
            return JsonValue.TRUE;
        case VALUE_FALSE:
            return JsonValue.FALSE;
        case VALUE_NULL:
            return JsonValue.NULL;
        case VALUE_STRING:
        case VALUE_NUMBER:
            return parser.getValue();
        default:
            throw new JsonbException(Messages.getMessage(MessageKeys.INTERNAL_ERROR, "Unknown JSON value: "+next));
    }
}
 
开发者ID:eclipse,项目名称:yasson,代码行数:17,代码来源:JsonValueDeserializer.java

示例3: getValue

@Override
public JsonValue getValue ()
{
	switch (m_event)
	{
		case START_ARRAY:
		case START_OBJECT:
			return Utils.getStructure (this);
		case END_ARRAY:
		case END_OBJECT:
		case KEY_NAME:
			throw stateError ("getValue()");
		case VALUE_TRUE:
			return JsonValue.TRUE;
		case VALUE_FALSE:
			return JsonValue.FALSE;
		case VALUE_NULL:
			return JsonValue.NULL;
		case VALUE_NUMBER:
			return new CookJsonBigDecimal (getBigDecimal ());
		case VALUE_STRING:
			return new CookJsonString (getString ());
	}
	throw stateError ("getValue()");
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:25,代码来源:TextJsonParser.java

示例4: mapValue

private static Boolean mapValue(JsonValue value) {
	if (value == JsonValue.TRUE) {
		return Boolean.TRUE;
	} else if (value == JsonValue.FALSE) {
		return Boolean.FALSE;
	} else {
		return null;
	}
}
 
开发者ID:i49,项目名称:hibiscus,代码行数:9,代码来源:BooleanTypeImpl.java

示例5: wrapValue

private JsonValue wrapValue(Object value) {
    JsonValue jsonValue = null;
    if (value instanceof Number) {
        Number number = (Number) value;
        if ((number instanceof Long) || (number instanceof Integer)) {
            jsonValue = Json.createObjectBuilder()
                    .add(TMP, number.longValue())
                    .build()
                    .getJsonNumber(TMP);
        } else {
            jsonValue = Json.createObjectBuilder()
                    .add(TMP, number.doubleValue())
                    .build()
                    .getJsonNumber(TMP);
        }
    } else if (value instanceof Boolean) {
        Boolean flag = (Boolean) value;
        jsonValue = flag ? JsonValue.TRUE : JsonValue.FALSE;
    } else if (value instanceof List) {
        JsonArrayBuilder arrayBuilder = Json.createArrayBuilder();
        List list = (List) value;
        for (Object element : list) {
            if (element instanceof String) {
                arrayBuilder.add(element.toString());
            } else {
                JsonValue jvalue = wrapValue(element);
                arrayBuilder.add(jvalue);
            }
        }
        jsonValue = arrayBuilder.build();
    }
    return jsonValue;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:33,代码来源:DefaultJWTCallerPrincipal.java

示例6: getValue

@Override
public JsonValue getValue ()
{
	if (m_event == null)
		throw new IllegalStateException ();
	switch (m_event)
	{
		case START_ARRAY:
		case START_OBJECT:
			return Utils.getStructure (this);
		case VALUE_STRING:
		{
			if (m_value instanceof byte[])
			{
				CookJsonBinary v = new CookJsonBinary ((byte[]) m_value);
				v.setBinaryFormat (m_binaryFormat);
				return v;
			}
			return new CookJsonString ((String) m_value);
		}
		case VALUE_NUMBER:
		{
			if (m_value instanceof Integer)
				return new CookJsonInt ((Integer)m_value);
			if (m_value instanceof Long)
				return new CookJsonLong ((Long)m_value);
			return new CookJsonDouble ((Double) m_value);
		}
		case VALUE_NULL:
			return JsonValue.NULL;
		case VALUE_TRUE:
			return JsonValue.TRUE;
		case VALUE_FALSE:
			return JsonValue.FALSE;
		default:
			throw new IllegalStateException ();
	}
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:38,代码来源:BsonParser.java


注:本文中的javax.json.JsonValue.TRUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。