當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonParser.getCurrentLocation方法代碼示例

本文整理匯總了Java中com.fasterxml.jackson.core.JsonParser.getCurrentLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonParser.getCurrentLocation方法的具體用法?Java JsonParser.getCurrentLocation怎麽用?Java JsonParser.getCurrentLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fasterxml.jackson.core.JsonParser的用法示例。


在下文中一共展示了JsonParser.getCurrentLocation方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public I18NStrings deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
	JsonProcessingException
{
	Map<String, LanguageString> strings = Maps.newHashMap();
	JsonToken currentToken = jp.getCurrentToken();
	if( currentToken != JsonToken.START_OBJECT )
	{
		throw new JsonParseException("Must be an object", jp.getCurrentLocation());
	}
	while( jp.nextToken() == JsonToken.FIELD_NAME )
	{
		String textValue = jp.nextTextValue();
		LanguageBundle tempBundle = LangUtils.createTempLangugageBundle(null, textValue);
		LanguageString tempLangString = LangUtils.createLanguageString(tempBundle, CurrentLocale.getLocale(),
			textValue);
		strings.put(jp.getCurrentName(), tempLangString);
	}
	return new SimpleI18NStrings(strings);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:21,代碼來源:RestStringsModule.java

示例2: testLocation

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
public void testLocation() throws Exception
{
    JsonFactory jf = new JsonFactory();
    JsonParser jp = jf.createParser(ObjectReadContext.empty(), "  { }");
    assertToken(JsonToken.START_OBJECT, jp.nextToken());
    JsonLocation loc = jp.getCurrentLocation();

    byte[] stuff = jdkSerialize(loc);
    JsonLocation loc2 = jdkDeserialize(stuff);
    assertNotNull(loc2);
    
    assertEquals(loc.getLineNr(), loc2.getLineNr());
    assertEquals(loc.getColumnNr(), loc2.getColumnNr());
    jp.close();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:TestJDKSerializability.java

示例3: deserialize

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
@Override
public LineString deserialize(JsonParser jp, DeserializationContext ctxt)
		throws IOException, JsonProcessingException {
	Geometry geom = parse(jp);
	if(geom instanceof LineString) {
		return (LineString)geom;		
	}
	throw new JsonParseException(jp, "parsed geometry was not a LineString!", jp.getCurrentLocation());
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:10,代碼來源:JacksonLineStringDeserializer.java

示例4: parse

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
private Geometry parse(JsonParser jp) throws IOException, JsonProcessingException {
	WKTReader reader = new WKTReader();
	Geometry geom;		
	try {
		geom = reader.read(jp.getText());
	} catch (ParseException e) {
		throw new JsonParseException(jp, "wkt not parsable", jp.getCurrentLocation(), e);
	}
	return geom;
}
 
開發者ID:graphium-project,項目名稱:graphium,代碼行數:11,代碼來源:JacksonLineStringDeserializer.java

示例5: throwE

import com.fasterxml.jackson.core.JsonParser; //導入方法依賴的package包/類
private static void throwE(JsonParser jp, String e) throws JsonParseException {
  throw new JsonParseException(e, jp.getCurrentLocation());
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:4,代碼來源:Sequence.java


注:本文中的com.fasterxml.jackson.core.JsonParser.getCurrentLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。