本文整理汇总了Java中io.vertx.core.json.JsonObject.fieldNames方法的典型用法代码示例。如果您正苦于以下问题:Java JsonObject.fieldNames方法的具体用法?Java JsonObject.fieldNames怎么用?Java JsonObject.fieldNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.fieldNames方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scan
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
@Override
public Set<Cliff> scan(final Set<Class<?>> walls) {
/** 1. Build result **/
final Set<Cliff> wallSet = new TreeSet<>();
final Set<Class<?>> wallClses = walls.stream()
.filter((item) -> item.isAnnotationPresent(Wall.class))
.collect(Collectors.toSet());
if (!wallClses.isEmpty()) {
/**
* It means that you have set Wall and enable security configuration
* wallClses verification
*/
final ConcurrentMap<String, Class<?>> keys = new ConcurrentHashMap<>();
final JsonObject config = this.verify(wallClses, keys);
for (final String field : config.fieldNames()) {
// Difference key setting
final Class<?> cls = keys.get(field);
final Cliff cliff = this.transformer.transform(config.getJsonObject(field));
// Set Information from class
mountData(cliff, cls);
wallSet.add(cliff);
}
}
/** 3. Transfer **/
return wallSet;
}
示例2: setDataBase
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private void setDataBase(JsonObject data){
for(String key:data.fieldNames()){
if(data.getValue(key)==null) continue;
if(data.getValue(key) instanceof Number){
pieChartData.add(new javafx.scene.chart.PieChart.Data(key, ((Number)data.getValue(key)).doubleValue()));
}else{
try{
double value = Double.parseDouble(data.getValue(key).toString());
pieChartData.add(new javafx.scene.chart.PieChart.Data(key, value));
}catch (Exception e){
//do nothing
}
}
}
((javafx.scene.chart.PieChart)body).setData(pieChartData);
}
示例3: build
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private static Envelop build(final JsonObject json) {
Envelop envelop = Envelop.ok();
// 1. Headers
if (null != json) {
// 2.Rebuild
if (json.containsKey("data")) {
envelop = Envelop.success(json.getValue("data"));
}
// 3.Header
if (null != json.getValue("header")) {
final MultiMap headers = MultiMap.caseInsensitiveMultiMap();
final JsonObject headerData = json.getJsonObject("header");
for (final String key : headerData.fieldNames()) {
final Object value = headerData.getValue(key);
if (null != value) {
headers.set(key, value.toString());
}
}
envelop.setHeaders(headers);
}
// 4.User
if (null != json.getValue("user")) {
envelop.setUser(new VirtualUser(json.getJsonObject("user")));
}
}
return envelop;
}
示例4: json
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
public JsonObject json(final Object entity, final boolean overwrite) {
final JsonObject data = Jackson.serializeJson(entity);
final JsonObject merged = this.converted.copy();
for (final String field : data.fieldNames()) {
if (overwrite) {
// If overwrite
merged.put(field, data.getValue(field));
} else {
if (!merged.containsKey(field)) {
merged.put(field, data.getValue(field));
}
}
}
return merged;
}
示例5: execZero
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
static <T> void execZero(final JsonObject data,
final ZeroBiConsumer<T, String> fnIt)
throws ZeroException {
for (final String name : data.fieldNames()) {
final Object item = data.getValue(name);
if (null != item) {
fnIt.accept((T) item, name);
}
}
}
示例6: setSeries
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private void setSeries(String name, JsonArray jsonArray){
javafx.scene.chart.XYChart.Series series = new javafx.scene.chart.XYChart.Series();
series.setName(name);
if(xScale == null) return;
for(int i=0;i<xScale.size();i++){
if(i<jsonArray.size()&&jsonArray.getValue(i)!=null) {
Object x = xScale.getValue(i);
if(xAxis instanceof CategoryAxis)
x = x.toString();
Object y = jsonArray.getValue(i);
if(y == null){
}else if(y instanceof Number)
addData(series,x,y);
else if(y instanceof JsonObject){
Object xx=null, yy=null, extra=null;
JsonObject jsonObject = (JsonObject)y;
for(String key:jsonObject.fieldNames()){
if(key.equals("x")) xx = jsonObject.getValue(key);
else if(key.equals("y")) yy = jsonObject.getValue(key);
else extra = jsonObject.getValue(key);
}
if(xx!=null&&yy!=null){
if(extra!=null) addData(series,xx,yy,extra);
else addData(series,xx,yy);
}
}
else
addData(series,x,y);
}
}
((javafx.scene.chart.XYChart)body).getData().add(series);
}
示例7: setDataBase
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
private void setDataBase(JsonObject jsonObject){
for(String name:jsonObject.fieldNames()){
if(jsonObject.getValue(name)!=null && jsonObject.getValue(name) instanceof JsonArray){
setSeries(name, jsonObject.getJsonArray(name));
}
}
}
示例8: factoryConfig
import io.vertx.core.json.JsonObject; //导入方法依赖的package包/类
/**
* Setup remote deployment related configuration such as maven settings
*/
private void factoryConfig() {
JsonObject proxyObj = BaseUtil.proxyFromSystemProps();
ResolverOptions resolverOptions = new ResolverOptions();
if (proxyObj.containsKey("httpProxyURL")) {
resolverOptions.setHttpProxy(proxyObj.getString("httpProxyURL"));
}
if (proxyObj.containsKey("httpsProxyURL")) {
resolverOptions.setHttpsProxy(proxyObj.getString("httpsProxyURL"));
}
if (this.deployConfig.containsKey("maven")) {
JsonObject mvnOpts = this.deployConfig.getJsonObject("maven");
Set<String> optKeys = mvnOpts.fieldNames();
Iterator<String> optIter = optKeys.iterator();
String optKey;
while (optIter.hasNext()) {
optKey = optIter.next();
switch (optKey) {
case "localRepo":
resolverOptions.setLocalRepository(mvnOpts.getString(optKey));
break;
case "remoteRepos":
List<String> remoteRepoList = BaseUtil.jsonArrayToList(mvnOpts.getJsonArray(optKey), String.class);
resolverOptions.setRemoteRepositories(remoteRepoList);
break;
case "snapshotRefresh":
resolverOptions.setRemoteSnapshotPolicy(mvnOpts.getString(optKey));
break;
default:
break;
}
}
}
// Language specific factories
this.vertx.registerVerticleFactory(new JSVerticleFactory());
this.vertx.registerVerticleFactory(new GroovyVerticleFactory());
this.vertx.registerVerticleFactory(new JRubyVerticleFactory());
this.vertx.registerVerticleFactory(new ScalaVerticleFactory());
this.vertx.registerVerticleFactory(new KotlinVerticleFactory());
this.vertx.registerVerticleFactory(new KotlinScriptVerticleFactory());
this.vertx.registerVerticleFactory(new CeylonVerticleFactory());
// Service factories
this.vertx.registerVerticleFactory(new ServiceVerticleFactory());
this.vertx.registerVerticleFactory(new HttpServiceFactory());
this.vertx.registerVerticleFactory(new HttpSecureServiceFactory());
this.vertx.registerVerticleFactory(new MavenVerticleFactory(resolverOptions));
}