當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。