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


Java ValueType.STRING属性代码示例

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


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

示例1: readAdapterNotes

private static String readAdapterNotes(JsonObject root) {
    if (root.containsKey("adapterNotes")) {
        JsonValue notes = root.get("adapterNotes");
        if (notes.getValueType() == ValueType.STRING) {
            // Return unquoted string
            return ((JsonString)notes).getString();
        } else {
            return notes.toString();
        }
    }
    return "";
}
 
开发者ID:EXASOL,项目名称:virtual-schemas,代码行数:12,代码来源:RequestJsonParser.java

示例2: jsonToMap

private Map<String, String> jsonToMap(JsonObject jsonOutput) {
	Map<String, String> resultMap = new HashMap<>();
	for(String key:jsonOutput.keySet()) {
		JsonValue value = jsonOutput.get(key);
		if(value.getValueType() == ValueType.STRING) {
			resultMap.put(key, jsonOutput.getString(key));
		} else if (!value.getValueType().equals(ValueType.OBJECT)&&!value.getValueType().equals(ValueType.ARRAY)) {
			resultMap.put(key, jsonOutput.getString(key).toString());
		}
	}
	return resultMap;
}
 
开发者ID:denkbar,项目名称:step,代码行数:12,代码来源:CallFunctionHandler.java

示例3: getString

/**
 * Get optional long value out of the message json payload
 *
 * @param key
 *            Key to find value for
 * @return value in object or null
 */
public String getString(String key) {
    String result = null;
    JsonObject obj = getParsedBody();
    JsonValue value = obj.get(key);
    if ( value != null ) {
        try {
            if ( value.getValueType() == ValueType.STRING) {
                result = obj.getString(key);
            } else {
                result = value.toString();
            }
        } catch (Exception e) { // class cast, etc
            Log.log(Level.FINER, this, "Exception parsing String: " + value, e);
            // fall through to return default value
        }
    }

    return result;
}
 
开发者ID:gameontext,项目名称:gameon-mediator,代码行数:26,代码来源:RoutedMessage.java

示例4: convertContentValue

@Override
public Object convertContentValue(Object value) {
	if (value instanceof JsonValue) {
		JsonValue val = (JsonValue) value;
		Object ret = null;
		ValueType typ = val.getValueType();
		if (typ == ValueType.NUMBER)
			ret = ((JsonNumber)val).bigDecimalValue();
		else if (typ == ValueType.STRING)
			ret = ((JsonString)val).getString();
		else if (typ == ValueType.FALSE)
			ret = Boolean.FALSE;
		else if (typ == ValueType.TRUE)
			ret = Boolean.TRUE;
		else if (typ == ValueType.ARRAY) {
			JsonArray arr = (JsonArray)val;
			List<Object> vals = new ArrayList<Object>();
			int sz = arr.size();
			for (int i = 0; i < sz; i++) {
				JsonValue v = arr.get(i);
				vals.add(convertContentValue(v));
			}
			ret = vals;
		} else if (typ == ValueType.OBJECT) {
			//JsonObject obj = (JsonObject)val;
		}
		return ret;
	}
	return value;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:30,代码来源:JSONContentHandler.java

示例5: getJsonValueAsString

private static String getJsonValueAsString(JsonValue value) {
    return (value != null && value.getValueType() == ValueType.STRING) ? ((JsonString) value).getString() : null;
}
 
开发者ID:hyperledger,项目名称:fabric-sdk-java,代码行数:3,代码来源:NetworkConfig.java

示例6: processValueFromMapOrObject

/**
 * <p>
 * So that the request is a valid OAuth 2.0 Authorization Request, values
 * for the response_type and client_id parameters MUST be included using the
 * OAuth 2.0 request syntax, since they are REQUIRED by OAuth 2.0. The
 * values for these parameters MUST match those in the Request Object, if
 * present.
 * </p>
 *
 * @param reqMap
 * @param key
 * @param servletRequest
 * @param requestObject
 */
private static void processValueFromMapOrObject(final Map<String, String> reqMap,
    final String key,
    final HttpServletRequest servletRequest,
    final JsonObject requestObject) {

    final String paramValue;
    if (servletRequest != null && servletRequest.getParameter(key) != null) {
        paramValue = servletRequest.getParameter(key);
    } else {
        paramValue = null;
    }

    final String requestObjectValue;
    if (requestObject == null || !requestObject.containsKey(key)) {
        requestObjectValue = null;
    } else if (requestObject.get(key)
        .getValueType() == ValueType.STRING) {
        requestObjectValue = requestObject.getString(key);
    } else if (requestObject.get(key)
        .getValueType() == ValueType.NUMBER) {
        requestObjectValue = requestObject.getJsonNumber(key)
            .bigIntegerValueExact()
            .toString();
    } else if (requestObject.get(key)
        .getValueType() == ValueType.OBJECT) {
        requestObjectValue = requestObject.getJsonObject(key)
            .toString();
    } else {
        requestObjectValue = null;
    }

    if (OpenIdConnectKey.CLIENT_ID.equals(key) && paramValue != null && requestObjectValue != null && !paramValue.equals(requestObjectValue)) {
        throw new BadRequestException("client_id does not match.");
    }

    if (OpenIdConnectKey.REDIRECT_URI.equals(key) && paramValue != null && requestObjectValue != null && !paramValue.equals(requestObjectValue)) {
        throw new BadRequestException("redirect_uri does not match.");
    }

    if (Util.isNotNullOrEmpty(requestObjectValue)) {
        reqMap.put(key, requestObjectValue);
    } else if (Util.isNotNullOrEmpty(paramValue)) {
        reqMap.put(key, paramValue);
    }
}
 
开发者ID:trajano,项目名称:openid-connect,代码行数:59,代码来源:AuthenticationRequest.java


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