io.vertx.core.json.JsonObject#getBoolean ( )源码实例Demo

下面列出了io.vertx.core.json.JsonObject#getBoolean ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: vertx-mongo-client   文件: IndexOptions.java
/**
 * Constructor from JSON
 *
 * @param options  the JSON
 */
public IndexOptions(JsonObject options) {
    background = options.getBoolean("background", DEFAULT_BACKGROUD);
    unique = options.getBoolean("unique", DEFAULT_UNIQUE);
    name = options.getString("name");
    sparse = options.getBoolean("sparse", DEFAULT_SPARSE);
    expireAfterSeconds = options.getLong("expireAfterSeconds");
    version = options.getInteger("version");
    weights = options.getJsonObject("weights");
    defaultLanguage = options.getString("defaultLanguage");
    languageOverride = options.getString("languageOverride");
    textVersion = options.getInteger("textVersion");
    sphereVersion = options.getInteger("sphereVersion");
    bits = options.getInteger("bits");
    min = options.getDouble("min");
    max = options.getDouble("max");
    bucketSize = options.getDouble("bucketSize");
    storageEngine = options.getJsonObject("storageEngine");
    partialFilterExpression = options.getJsonObject("partialFilterExpression");
}
 
源代码2 项目: vertx-web   文件: SockJSHandlerOptions.java
public SockJSHandlerOptions(JsonObject json) {
  this.sessionTimeout = json.getLong("sessionTimeout", DEFAULT_SESSION_TIMEOUT);
  this.insertJSESSIONID = json.getBoolean("insertJSESSIONID", DEFAULT_INSERT_JSESSIONID);
  this.heartbeatInterval = json.getLong("heartbeatInterval", DEFAULT_HEARTBEAT_INTERVAL);
  this.maxBytesStreaming = json.getInteger("maxBytesStreaming", DEFAULT_MAX_BYTES_STREAMING);
  this.libraryURL = json.getString("libraryURL", DEFAULT_LIBRARY_URL);
  JsonArray arr = json.getJsonArray("disabledTransports");
  if (arr != null) {
    for (Object str : arr) {
      if (str instanceof String) {
        String sstr = (String) str;
        disabledTransports.add(sstr);
      } else {
        throw new IllegalArgumentException("Invalid type " + str.getClass() + " in disabledTransports array");
      }
    }
  }
}
 
源代码3 项目: enmasse   文件: KubeAuthApi.java
@Override
public io.enmasse.api.auth.SubjectAccessReview performSubjectAccessReviewResource(TokenReview tokenReview, String namespace, String resource, String resourceName, String verb, String apiGroup) {
    if (client.isAdaptable(OkHttpClient.class)) {
        JsonObject body = new JsonObject();

        body.put("kind", "SubjectAccessReview");
        body.put("apiVersion", "authorization.k8s.io/v1");

        JsonObject spec = new JsonObject();

        JsonObject resourceAttributes = new JsonObject();
        resourceAttributes.put("group", apiGroup);
        resourceAttributes.put("namespace", namespace);
        resourceAttributes.put("resource", resource);
        if (resourceName != null) {
            resourceAttributes.put("name", resourceName);
        }
        resourceAttributes.put("verb", verb);

        spec.put("resourceAttributes", resourceAttributes);

        putCommonSpecAttributes(spec, tokenReview);

        body.put("spec", spec);
        log.debug("Subject access review request: {}", body);
        JsonObject responseBody = doRawHttpRequest("/apis/authorization.k8s.io/v1/subjectaccessreviews", "POST", body, false);
        log.debug("Subject access review response: {}", responseBody);

        JsonObject status = responseBody.getJsonObject("status");
        boolean allowed = false;
        if (status != null) {
            Boolean allowedMaybe = status.getBoolean("allowed");
            allowed = allowedMaybe == null ? false : allowedMaybe;
        }
        return new io.enmasse.api.auth.SubjectAccessReview(tokenReview.getUserName(), allowed);
    } else {
        return new SubjectAccessReview(tokenReview.getUserName(), false);
    }
}
 
源代码4 项目: rxjava2-lab   文件: Character.java
public Character(JsonObject json) {
    this.id = json.getInteger("id");
    this.name = json.getString("name");
    this.villain = json.getBoolean("villain");
    JsonArray powers = json.getJsonArray("superpowers");
    this.superpowers = powers.stream().map(Object::toString).collect(Collectors.toList());

}
 
源代码5 项目: kyoko   文件: UserData.java
public UserData(@NotNull JsonObject object) {
    this.id = Objects.requireNonNull(object).getLong("id");
    this.blacklisted = object.getBoolean("blacklisted");
    this.flags = object.getInteger("flags", 0);
    this.language = Language.valueOfSafe(object.getString("language", "DEFAULT"));
    this.color = object.getInteger("color", 0xff4757);
    this.image = object.getString("image", "default");
    this.voted = object.getLong("voted");
}
 
源代码6 项目: kyoko   文件: ModerationConfig.java
public ModerationConfig(@NotNull JsonObject object) {
    this.id = Objects.requireNonNull(object).getLong("id");
    this.admins = JsonUtil.toListLong(object, "admins");
    this.moderators = JsonUtil.toListLong(object, "moderators");
    this.antiInvite = object.getBoolean("anti_invite");
    this.appealInfo = object.getString("appeal_info");
}
 
源代码7 项目: vert.x-microservice   文件: ServiceRegistry.java
private void initConfiguration(JsonObject config) {
    expiration_age = config.getLong("expiration", DEFAULT_EXPIRATION_AGE);
    ping_time = config.getLong("ping", DEFAULT_PING_TIME);
    sweep_time = config.getLong("sweep", DEFAULT_SWEEP_TIME);
    timeout_time = config.getLong("timeout", DEFAULT_TIMEOUT);
    serviceRegisterPath = config.getString("serviceRegisterPath", GlobalKeyHolder.SERVICE_REGISTER_HANDLER);
    serviceUnRegisterPath = config.getString("serviceUnRegisterPath", GlobalKeyHolder.SERVICE_UNREGISTER_HANDLER);
    host = config.getString("host", HOST);
    port = config.getInteger("port", PORT);
    mainURL = host.concat(":").concat(Integer.valueOf(port).toString());
    debug = config.getBoolean("debug",false);

}
 
源代码8 项目: VX-API-Gateway   文件: VxApiMain.java
/**
 * 执行CLI的相应指令
 * 
 * @param config
 * @param handler
 */
public void runCLICommand(JsonObject config, Handler<AsyncResult<Void>> handler) {
	// 执行客户端
	if (config.getBoolean("startEverything", false) != false) {
		vertx.eventBus().send(VxApiEventBusAddressConstant.CLI_START_EVERYTHING, null, res -> {
			if (res.failed()) {
				handler.handle(Future.failedFuture(res.cause()));
			}
		});
	} else if (config.getBoolean("startAllAPP", false) != false) {
		vertx.eventBus().send(VxApiEventBusAddressConstant.CLI_START_ALL_APP, null, res -> {
			if (res.failed()) {
				handler.handle(Future.failedFuture(res.cause()));
			}
		});
	} else if (config.getJsonArray("startAPPEverything") != null) {
		vertx.eventBus().send(VxApiEventBusAddressConstant.CLI_START_APP_EVERYTHING, config.getJsonArray("startAPPEverything"), res -> {
			if (res.failed()) {
				handler.handle(Future.failedFuture(res.cause()));
			}
		});
	} else if (config.getJsonArray("startAPP") != null) {
		vertx.eventBus().send(VxApiEventBusAddressConstant.CLI_START_APP, config.getJsonArray("startAPP"), res -> {
			if (res.failed()) {
				handler.handle(Future.failedFuture(res.cause()));
			}
		});
	}
	handler.handle(Future.succeededFuture());
}
 
@Override
public ParameterProcessor generate(JsonObject parameter, JsonObject fakeSchema, JsonPointer parameterPointer, ParameterLocation parsedLocation, String parsedStyle, GeneratorContext context) {
  JsonObject originalSchema = (JsonObject) SCHEMA_POINTER.queryJsonOrDefault(parameter, new JsonObject());
  SchemaHolder schemas = context.getSchemaHolder(
    originalSchema, context.fakeSchema(fakeSchema),
    parameterPointer.copy().append("content").append("application/json").append("schema")
  );
  return new ParameterProcessorImpl(
    parameter.getString("name"),
    parsedLocation,
    !parameter.getBoolean("required", false),
    new SingleValueParameterParser(parameter.getString("name"), ValueParser.JSON_PARSER),
    schemas.getValidator()
  );
}
 
private Record createRecord(Service service) {
  String address = service.getAddress();
  int port = service.getPort();

  JsonObject metadata = service.toJson();
  if (service.getTags() != null) {
    service.getTags().forEach(tag -> metadata.put(tag, true));
  }

  Record record = new Record()
      .setName(service.getName())
      .setMetadata(metadata);

  // To determine the record type, check if we have a tag with a "type" name
  record.setType(ServiceType.UNKNOWN);
  ServiceTypes.all().forEachRemaining(type -> {
    if (metadata.getBoolean(type.name(), false)) {
      record.setType(type.name());
    }
  });

  JsonObject location = new JsonObject();
  location.put("host", address);
  location.put("port", port);

  // Manage HTTP endpoint
  if (record.getType().equals("http-endpoint")) {
    if (metadata.getBoolean("ssl", false)) {
      location.put("ssl", true);
    }
    location = new HttpLocation(location).toJson();
  }

  record.setLocation(location);
  return record;
}
 
源代码11 项目: kube_vertx_demo   文件: InitMongoDB.java
public static MongoClient initMongoData(Vertx vertx,JsonObject config) {
    MongoClient mongo;
    // Create a mongo client using all defaults (connect to localhost and default port) using the database name "demo".
    String connectionUrl = connectionURL();
    boolean local = config.getBoolean("local", false);
    if (connectionUrl != null && !local) {
        String dbName = config.getString("dbname", "vxmsdemo");
        mongo = MongoClient.createShared(vertx, new JsonObject().put("connection_string", connectionUrl).put("db_name", dbName));
    } else {
        mongo = MongoClient.createShared(vertx, new JsonObject().put("db_name", "demo"));
    }
    // the load function just populates some data on the storage
    return mongo;
}
 
源代码12 项目: vertx-mqtt   文件: MqttWill.java
/**
 * Create instance from JSON
 *
 * @param json the JSON
 */
public MqttWill(JsonObject json) {
  this.isWillFlag = json.getBoolean("isWillFlag");
  this.willTopic = json.getString("willTopic");
  this.willMessage = json.getString("willMessage").getBytes(Charset.forName("UTF-8"));
  this.willQos = json.getInteger("willMessage");
  this.isWillRetain = json.getBoolean("isWillRetain");
}
 
源代码13 项目: vxms   文件: InitMongoDB.java
public static MongoClient initMongoData(Vertx vertx, JsonObject config) {
    MongoClient mongo;
    // Create a mongo client using all defaults (connect to localhost and default port) using the database name "demo".
    String connectionUrl = connectionURL();
    boolean local = config.getBoolean("local", false);
    if (connectionUrl != null && !local) {
        String dbName = config.getString("dbname", "vxmsdemo");
        mongo = MongoClient.createShared(vertx, new JsonObject().put("connection_string", connectionUrl).put("db_name", dbName));
    } else {
        mongo = MongoClient.createShared(vertx, new JsonObject().put("db_name", "demo"));
    }
    // the load function just populates some data on the storage
    return mongo;
}
 
源代码14 项目: kube_vertx_demo   文件: InitMongoDB.java
public static void initMongoData(Vertx vertx,JsonObject config) {
    MongoClient mongo;
    // Create a mongo client using all defaults (connect to localhost and default port) using the database name "demo".
    String connectionUrl = connectionURL();
    boolean local = config.getBoolean("local", false);
    if (connectionUrl != null && !local) {
        String dbName = config.getString("dbname", "vxmsdemo");
        mongo = MongoClient.createShared(vertx, new JsonObject().put("connection_string", connectionUrl).put("db_name", dbName));
    } else {
        mongo = MongoClient.createShared(vertx, new JsonObject().put("db_name", "demo"));
    }
    // the load function just populates some data on the storage
    loadData(mongo);
}
 
源代码15 项目: sfs   文件: BlobReference.java
public T merge(JsonObject jsonObject) {
    volumeId = jsonObject.getString("volume_id");
    position = jsonObject.getLong("position");
    readSha512 = jsonObject.getBinary("read_sha512");
    readLength = jsonObject.getLong("read_length");
    acknowledged = jsonObject.getBoolean("acknowledged");
    deleted = jsonObject.getBoolean("deleted");
    verifyFailCount = jsonObject.getInteger("verify_fail_count", 0);

    return (T) this;
}
 
源代码16 项目: vertx-config   文件: EnvVariablesConfigStore.java
@Override
public ConfigStore create(Vertx vertx, JsonObject configuration) {
  return new EnvVariablesConfigStore(configuration.getBoolean("raw-data", false), configuration.getJsonArray("keys"));
}
 
源代码17 项目: enmasse   文件: KubeAuthApi.java
@Override
public TokenReview performTokenReview(String token) {
    if (client.isAdaptable(OkHttpClient.class)) {
        JsonObject body = new JsonObject();

        body.put("kind", "TokenReview");
        body.put("apiVersion", "authentication.k8s.io/v1");

        JsonObject spec = new JsonObject();
        spec.put("token", token);
        body.put("spec", spec);

        log.debug("Token review request: {}", body);
        JsonObject responseBody= doRawHttpRequest("/apis/authentication.k8s.io/v1/tokenreviews", "POST", body, false);
        log.debug("Token review response: {}", responseBody);
        JsonObject status = responseBody.getJsonObject("status");
        boolean authenticated = false;
        String userName = null;
        String userId = null;
        Set<String> groups = null;
        Map<String, List<String>> extra = null;
        if (status != null) {
            Boolean auth = status.getBoolean("authenticated");
            authenticated = auth == null ? false : auth;
            JsonObject user = status.getJsonObject("user");
            if (user != null) {
                userName = user.getString("username");
                userId = user.getString("uid");
                JsonArray groupArray = user.getJsonArray("groups");
                if (groupArray != null) {
                    groups = new HashSet<>();
                    for (int i = 0; i < groupArray.size(); i++) {
                        groups.add(groupArray.getString(i));
                    }
                }

                JsonObject extraObject = user.getJsonObject("extra");
                if (extraObject != null) {
                    extra = new HashMap<>();
                    for (String field : extraObject.fieldNames()) {
                        JsonArray extraValues = extraObject.getJsonArray(field);
                        List<String> extraValuesList = new ArrayList<>();
                        for (int i = 0; i < extraValues.size(); i++) {
                            extraValuesList.add(extraValues.getString(i));
                        }
                        extra.put(field, extraValuesList);
                    }
                }

            }
        }
        return new TokenReview(userName, userId, groups, extra, authenticated);
    } else {
        return new TokenReview(null, null, null, null, false);
    }
}
 
源代码18 项目: nassh-relay   文件: CookieHandler.java
public CookieHandler(final JsonObject config) {
    this.authentication = config.getBoolean("authentication", true);
    this.secureCookie = config.getBoolean("secure-cookie", true);
    this.sessionTTL = config.getInteger("auth-session-timeout", 600);
    this.auth = config.getJsonObject("auth");
}
 
源代码19 项目: vertx-codetrans   文件: JsObject.java
@CodeTranslate
public void getBooleanFromIdentifier() throws Exception {
  JsonObject obj = new JsonObject().put("_true", true);
  JsonTest.o = obj.getBoolean("_true");
}
 
源代码20 项目: apiman   文件: Vertx3GatewayHelper.java
/**
 * get gateway port dynamically from configuration
 * @param apiToFilePushEmulatorConfig configuration
 * @return gateway port
 */
public int getGatewayPortDynamically(JsonObject apiToFilePushEmulatorConfig) {
    boolean preferSecure = apiToFilePushEmulatorConfig.getBoolean("preferSecure");
    String method = preferSecure ? "https" : "http";
    return apiToFilePushEmulatorConfig.getJsonObject("verticles").getJsonObject(method).getInteger("port");
}