Refine search
public static Boolean getAsBoolean(JsonObject parent, String name) { JsonElement el = parent.get(name); return el == null ? null : el.getAsBoolean(); }
@Override public boolean isRunning() { JsonObject state = json.getAsJsonObject(STATE); return state.get(RUNNING).getAsBoolean(); }
if (obj.has("params") && obj.get("params").isJsonObject()) { JsonObject params = obj.get("params").getAsJsonObject(); for (Map.Entry<String, JsonElement> prop : params.entrySet()) { if (prop.getValue().isJsonPrimitive()) { metadata.floatParams.put(prop.getKey(), prop.getValue().getAsFloat()); } else if (prop.getValue().getAsJsonPrimitive().isBoolean()) { metadata.intParams.put(prop.getKey(), (prop.getValue().getAsBoolean()) ? 1 : 0);
JsonObject field = columnElement.getAsJsonObject(); Schema schema = new Schema(); schema.setColumnName(field.get("name").getAsString()); String dataType = field.get("type").getAsString(); String elementDataType = "string"; List<String> mapSymbols = null; JsonObject newDataType = this.convertDataType(field.get("name").getAsString(), dataType, elementDataType, mapSymbols); log.debug("ColumnName:" + field.get("name").getAsString() + "; old datatype:" + dataType + "; new datatype:" + newDataType); schema.setPrecision(field.get("precision").getAsInt()); schema.setScale(field.get("scale").getAsInt()); schema.setNullable(field.get("nillable").getAsBoolean()); schema.setFormat(null); schema.setComment((field.get("label").isJsonNull() ? null : field.get("label").getAsString())); schema .setDefaultValue((field.get("defaultValue").isJsonNull() ? null : field.get("defaultValue").getAsString())); schema.setUnique(field.get("unique").getAsBoolean());
@Override public BlockShapeData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { BlockShapeData shape = new BlockShapeData(); JsonObject shapeObj = json.getAsJsonObject(); if (shapeObj.has(DISPLAY_NAME)) { shape.setDisplayName(shapeObj.getAsJsonPrimitive(DISPLAY_NAME).getAsString()); } for (BlockPart part : BlockPart.values()) { if (shapeObj.has(part.toString().toLowerCase(Locale.ENGLISH))) { JsonObject meshObj = shapeObj.getAsJsonObject(part.toString().toLowerCase(Locale.ENGLISH)); shape.setMeshPart(part, (BlockMeshPart) context.deserialize(meshObj, BlockMeshPart.class)); if (part.isSide() && meshObj.has(FULL_SIDE)) { shape.setBlockingSide(part.getSide(), meshObj.get(FULL_SIDE).getAsBoolean()); } } } if (shapeObj.has(COLLISION) && shapeObj.get(COLLISION).isJsonObject()) { JsonObject collisionInfo = shapeObj.get(COLLISION).getAsJsonObject(); processCollision(context, shape, collisionInfo); } else { shape.setCollisionShape(COLLISION_SHAPE_FACTORY.getNewUnitCube()); shape.setCollisionSymmetric(true); } return shape; }
if (jsonObject.get("done").getAsBoolean()) { setPullStatus(false); } else { setNextUrl(this.sfConnector.getFullUri( jsonObject.get("nextRecordsUrl").getAsString().replaceAll(this.sfConnector.getServicesDataEnvPath(), "")));
public static Boolean getAsBoolean(JsonObject parent, String name, boolean defaultValue) { JsonElement el = parent.get(name); return el == null ? defaultValue : el.getAsBoolean(); }
String key = outputSchemaJsonObject.get(COLUMN_NAME_KEY).getAsString(); String type = outputSchemaJsonObject.getAsJsonObject(DATA_TYPE).get(TYPE_KEY).getAsString(); if (!outputSchemaJsonObject.get(NULLABLE).getAsBoolean()) { throw new DataConversionException( "Field " + key + " is null or not exists but it is non-nullable by the schema."); break; case "boolean": outputRecord.addProperty(key, jsonElement.getAsBoolean()); break; case "string":
public boolean isRunning() { return json.get(RUNNING).getAsBoolean(); }
component.setColor( ChatColor.valueOf( object.get( "color" ).getAsString().toUpperCase( Locale.ROOT ) ) ); component.setBold( object.get( "bold" ).getAsBoolean() ); component.setItalic( object.get( "italic" ).getAsBoolean() ); component.setUnderlined( object.get( "underlined" ).getAsBoolean() ); component.setStrikethrough( object.get( "strikethrough" ).getAsBoolean() ); component.setObfuscated( object.get( "obfuscated" ).getAsBoolean() );
public boolean didTimeOut() { return (jsonObject != null && jsonObject.has("timed_out")) ? jsonObject.get("timed_out").getAsBoolean() : false; }
/** * Gets the value of the given member as a boolean, null if it doesn't exist */ public static Boolean getAsBoolean(JsonObject o, String member) { if (o.has(member)) { JsonElement e = o.get(member); if (e != null && e.isJsonPrimitive()) { return e.getAsBoolean(); } else { return null; } } else { return null; } }
public static EnvironmentVariableConfig fromJSON(JsonObject jsonReader) { String name = jsonReader.get("name").getAsString(); String value = jsonReader.get("value").getAsString(); boolean secure = jsonReader.has("secure") && jsonReader.get("secure").getAsBoolean(); EnvironmentVariableConfig environmentConfig = new EnvironmentVariableConfig(new GoCipher(), name, value, secure); return environmentConfig; }
private void formatIgnoredConditions(JsonObject json) { JsonElement ignoredConditions = json.get("ignoredConditions"); if (ignoredConditions != null) { projectStatusBuilder.setIgnoredConditions(ignoredConditions.getAsBoolean()); } else { projectStatusBuilder.setIgnoredConditions(false); } }
@Override public AgentRuntimeInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); AgentIdentifier identifier = context.deserialize(jsonObject.get("identifier"), AgentIdentifier.class); AgentRuntimeStatus runtimeStatus = context.deserialize(jsonObject.get("runtimeStatus"), AgentRuntimeStatus.class); AgentBuildingInfo buildingInfo = context.deserialize(jsonObject.get("buildingInfo"), AgentBuildingInfo.class); String location = jsonObject.has("location") ? jsonObject.get("location").getAsString() : null; Long usableSpace = jsonObject.has("usableSpace") ? jsonObject.get("usableSpace").getAsLong() : null; String operatingSystemName = jsonObject.has("operatingSystemName") ? jsonObject.get("operatingSystemName").getAsString() : null; String cookie = jsonObject.has("cookie") ? jsonObject.get("cookie").getAsString() : null; boolean supportsBuildCommandProtocol = jsonObject.has("supportsBuildCommandProtocol") && jsonObject.get("supportsBuildCommandProtocol").getAsBoolean(); String elasticPluginId = jsonObject.has("elasticPluginId") ? jsonObject.get("elasticPluginId").getAsString() : null; String elasticAgentId = jsonObject.has("elasticAgentId") ? jsonObject.get("elasticAgentId").getAsString() : null; AgentRuntimeInfo info; if (elasticPluginId == null || StringUtils.isBlank(elasticPluginId)) { info = new AgentRuntimeInfo(identifier, runtimeStatus, location, cookie, supportsBuildCommandProtocol); } else { info = new ElasticAgentRuntimeInfo(identifier, runtimeStatus, location, cookie, elasticAgentId, elasticPluginId); } info.setUsableSpace(usableSpace); info.setOperatingSystem(operatingSystemName); info.setSupportsBuildCommandProtocol(supportsBuildCommandProtocol); info.setBuildingInfo(buildingInfo); return info; } }
private void inputEventSetup(InputEvent event, JsonObject jsonObject) { float delta = jsonObject.get("delta").getAsFloat(); boolean consumed = jsonObject.get("consumed").getAsBoolean(); EntityRef target = new RecordedEntityRef(jsonObject.get("target").getAsLong(), (LowLevelEntityManager) this.entityManager); JsonObject aux = jsonObject.get("hitNormal").getAsJsonObject(); Vector3f hitNormal = new Vector3f(aux.get("x").getAsFloat(), aux.get("y").getAsFloat(), aux.get("z").getAsFloat()); aux = jsonObject.get("hitPosition").getAsJsonObject(); Vector3f hitPosition = new Vector3f(aux.get("x").getAsFloat(), aux.get("y").getAsFloat(), aux.get("z").getAsFloat()); aux = jsonObject.get("targetBlockPosition").getAsJsonObject(); Vector3i targetBlockPosition = new Vector3i(aux.get("x").getAsInt(), aux.get("y").getAsInt(), aux.get("z").getAsInt()); event.setTargetInfo(target, targetBlockPosition, hitPosition, hitNormal); } }
if (!jsonBody.get("hasErrors").getAsBoolean()) { return; JsonArray results = jsonBody.get("results").getAsJsonArray(); for (JsonElement jsonElem : results) { JsonObject json = jsonElem.getAsJsonObject(); int subStatusCode = json.get("statusCode").getAsInt(); if (subStatusCode < 400) { continue;
private void processCollision(JsonDeserializationContext context, BlockShapeData shape, JsonObject collisionInfo) { if (collisionInfo.has(PITCH_SYMMETRIC) && collisionInfo.get(PITCH_SYMMETRIC).isJsonPrimitive() && collisionInfo.get(PITCH_SYMMETRIC).getAsJsonPrimitive().isBoolean()) { shape.setPitchSymmetric(collisionInfo.get(PITCH_SYMMETRIC).getAsBoolean()); if (collisionInfo.has(YAW_SYMMETRIC) && collisionInfo.get(YAW_SYMMETRIC).isJsonPrimitive() && collisionInfo.get(YAW_SYMMETRIC).getAsJsonPrimitive().isBoolean()) { shape.setYawSymmetric(collisionInfo.get(YAW_SYMMETRIC).getAsBoolean()); if (collisionInfo.has(ROLL_SYMMETRIC) && collisionInfo.get(ROLL_SYMMETRIC).isJsonPrimitive() && collisionInfo.get(ROLL_SYMMETRIC).getAsJsonPrimitive().isBoolean()) { shape.setRollSymmetric(collisionInfo.get(ROLL_SYMMETRIC).getAsBoolean()); if (collisionInfo.has(SYMMETRIC) && collisionInfo.get(SYMMETRIC).isJsonPrimitive() && collisionInfo.get(SYMMETRIC).getAsJsonPrimitive().isBoolean()) { if (collisionInfo.get(SYMMETRIC).getAsBoolean()) { shape.setCollisionSymmetric(true);
/** * Set properties for {@link JsonSchema} from a {@link JsonObject}. * @param jsonObject */ private void setJsonSchemaProperties(JsonObject jsonObject) { setColumnName(jsonObject.get(COLUMN_NAME_KEY).getAsString()); setDataType(jsonObject.get(DATA_TYPE_KEY).getAsJsonObject()); setNullable(jsonObject.has(IS_NULLABLE_KEY) && jsonObject.get(IS_NULLABLE_KEY).getAsBoolean()); setComment(getOptionalProperty(jsonObject, COMMENT_KEY)); setDefaultValue(getOptionalProperty(jsonObject, DEFAULT_VALUE_KEY)); } }
/** * Set properties for {@link JsonSchema} from a {@link JsonObject}. * @param jsonObject */ private void setJsonSchemaProperties(JsonObject jsonObject) { setColumnName(jsonObject.get(COLUMN_NAME_KEY).getAsString()); setDataType(jsonObject.get(DATA_TYPE_KEY).getAsJsonObject()); setNullable(jsonObject.has(IS_NULLABLE_KEY) && jsonObject.get(IS_NULLABLE_KEY).getAsBoolean()); setComment(getOptionalProperty(jsonObject, COMMENT_KEY)); setDefaultValue(getOptionalProperty(jsonObject, DEFAULT_VALUE_KEY)); }