com.google.gson.JsonElement.getAsCharacter()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中com.google.gson.JsonElement.getAsCharacter()方法的一些代码示例,展示了JsonElement.getAsCharacter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonElement.getAsCharacter()方法的具体详情如下:
包路径:com.google.gson.JsonElement
类名称:JsonElement
方法名:getAsCharacter

JsonElement.getAsCharacter介绍

[英]convenience method to get this element as a primitive character value.
[中]将此元素作为基本字符值获取的简便方法。

代码示例

代码示例来源:origin: searchbox-io/Jest

return (T) (Character) id.getAsCharacter();

代码示例来源:origin: MovingBlocks/Terasology

typeHandler = typeSerializationLibrary.getTypeHandlerFromClass(ButtonState.class);
ButtonState state = (ButtonState) typeHandler.deserialize(data, deserializationContext);
char keychar = jsonObject.get("keychar").getAsCharacter();
float delta = jsonObject.get("delta").getAsFloat();
KeyEvent aux;

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: eatnumber1/google-gson

public Character deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
  throws JsonParseException {
 return json.getAsCharacter();
}

代码示例来源:origin: fenix-framework/fenix-framework

public static char getCharFromJson(JsonElement value) {
  return value.getAsCharacter();
}

代码示例来源:origin: fenix-framework/fenix-framework

public static Character getCharacterFromJson(JsonElement value) {
  if (value.isJsonNull()) {
    return null;
  }
  return value.getAsCharacter();
}

代码示例来源:origin: Nextdoor/bender

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: com.google/gson

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.gson

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: Odoo-mobile/framework

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: fesch/CanZE

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: eatnumber1/google-gson

@Override
public char getAsCharacter() {
 if (elements.size() == 1) {
  return elements.get(0).getAsCharacter();
 }
 throw new IllegalStateException();
}

代码示例来源:origin: mapbox/mapbox-java

/**
 * Convenience method to get a Character member.
 *
 * @param key name of the member
 * @return the value of the member, null if it doesn't exist
 * @since 1.0.0
 */
public Character getCharacterProperty(String key) {
 return properties().get(key).getAsCharacter();
}

代码示例来源:origin: com.github.dakusui/logiaslisp

public static char asCharWithDefaultValue(JsonObject json, char defaultValue, Object... path) {
  JsonElement elem = asJson(json, path);
  return elem == null ? null
            : elem.getAsCharacter();
}

代码示例来源:origin: com.mapbox.mapboxsdk/mapbox-sdk-geojson

/**
 * Convenience method to get a Character member.
 *
 * @param key name of the member
 * @return the value of the member, null if it doesn't exist
 * @since 1.0.0
 */
public Character getCharacterProperty(String key) {
 return properties().get(key).getAsCharacter();
}

代码示例来源:origin: com.mapbox.mapboxsdk/mapbox-java-geojson

/**
 * Convenience method to get a Character member.
 *
 * @param key name of the member
 * @return the value of the member, null if it doesn't exist
 * @since 1.0.0
 */
public Character getCharacterProperty(String key) {
 return getProperties().get(key).getAsCharacter();
}

代码示例来源:origin: McJtyMods/LostCities

@Override
public void readFromJSon(JsonObject object) {
  name = object.get("name").getAsString();
  if (object.has("minfloors")) {
    minFloors = object.get("minfloors").getAsInt();
  }
  if (object.has("mincellars")) {
    minCellars = object.get("mincellars").getAsInt();
  }
  if (object.has("maxfloors")) {
    maxFloors = object.get("maxfloors").getAsInt();
  }
  if (object.has("maxcellars")) {
    maxCellars = object.get("maxcellars").getAsInt();
  }
  if (object.has("preferslonely")) {
    prefersLonely = object.get("preferslonely").getAsFloat();
  }
  if (object.has("filler")) {
    fillerBlock = object.get("filler").getAsCharacter();
  } else {
    throw new RuntimeException("'filler' is required for building '" + name + "'!");
  }
  readParts(object, this.parts, "parts");
  readParts(object, this.parts2, "parts2");
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

return (T) (Boolean) input.getAsBoolean();
} else if (expected == char.class || expected == Character.class) {
  return (T) (Character) input.getAsCharacter();
} else if (expected == byte.class || expected == Byte.class) {
  return (T) (Byte) input.getAsByte();

代码示例来源:origin: apache/incubator-edgent

@Test
  public void testValueOfCharacter() {
   JsonObject jo = JsonFunctions.valueOfCharacter("propName").apply('c');
   assertEquals('c', jo.get("propName").getAsCharacter());
  }
}

相关文章