本文整理汇总了Java中net.minidev.json.JSONObject.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.keySet方法的具体用法?Java JSONObject.keySet怎么用?Java JSONObject.keySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minidev.json.JSONObject
的用法示例。
在下文中一共展示了JSONObject.keySet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import net.minidev.json.JSONObject; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (getOidcResponseContext().getIDToken() == null) {
log.error("{} No id token", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
return;
}
for (IdPAttribute attribute : attributeCtx.getIdPAttributes().values()) {
final Set<AttributeEncoder<?>> encoders = attribute.getEncoders();
if (encoders.isEmpty()) {
log.debug("{} Attribute {} does not have any encoders, nothing to do", getLogPrefix(),
attribute.getId());
continue;
}
for (final AttributeEncoder<?> encoder : encoders) {
try {
if (encoder instanceof AbstractOIDCAttributeEncoder) {
// TODO: missing a activation condition check for
// encoder!
JSONObject obj = (JSONObject) encoder.encode(attribute);
// There should be exactly one key
for (String name : obj.keySet()) {
log.debug("Adding claim {} with value {}", name, obj.get(name));
getOidcResponseContext().getIDToken().setClaim(name, obj.get(name));
}
}
} catch (AttributeEncodingException e) {
log.warn("{} Unable to encode attribute {} as OIDC attribute",
getLogPrefix(), attribute.getId(), e);
}
}
}
log.debug("{} id token after mapping attributes to claims {}", getLogPrefix(), getOidcResponseContext()
.getIDToken().toJSONObject().toJSONString());
}
示例2: loadConfigHierarchy
import net.minidev.json.JSONObject; //导入方法依赖的package包/类
private void loadConfigHierarchy() throws Exception {
if (resource != null && bundle != null) {
String key = resource.getPath();
if (USE_CACHE_FOR_CONFIGURATION && configCache.containsKey(key)) {
configMembers = configCache.get(key);
} else {
ExtendedNodeType extendedNodeType = resource.getNode().getPrimaryNodeType();
Map<String, ExtendedNodeType> map = getAllNodeTypesForNode(extendedNodeType, new LinkedHashMap<String, ExtendedNodeType>());
if ( map.size() > 0 ){
for (String keyMap : map.keySet()){
ExtendedNodeType nodeTypeToEvaluate = map.get(keyMap);
JSONObject xkConfigJSONObj = getJSON( nodeTypeToEvaluate );
if (xkConfigJSONObj != null) {
Map<String, InertProperty> propsMap = new LinkedHashMap<>();
for (String jsonKey : xkConfigJSONObj.keySet()) {
Object object = xkConfigJSONObj.get(jsonKey);
InertProperty property = new InertProperty(jsonKey, object);
propsMap.put(jsonKey, property);
}
configMembers.put(keyMap, propsMap);
} else {
// TODO review if LOG is needed here or not.
// LOG.error(LOG_PRE + "Not able to load file into JSON Object: {}, check your configuration node",nodeTypeToEvaluate);
}
}
if (USE_CACHE_FOR_CONFIGURATION) {
configCache.put(key, configMembers);
}
}
}
}
propNamesDeepCache = names(false);
}