本文整理汇总了C#中com.getCurrentName方法的典型用法代码示例。如果您正苦于以下问题:C# com.getCurrentName方法的具体用法?C# com.getCurrentName怎么用?C# com.getCurrentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com
的用法示例。
在下文中一共展示了com.getCurrentName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: copyCurrentStructure
/// <summary>
/// Method for copying contents of the current event
/// <b>and following events that it encloses</b>
/// the given parser instance points to.
/// </summary>
/// <remarks>
/// Method for copying contents of the current event
/// <b>and following events that it encloses</b>
/// the given parser instance points to.
/// <p>
/// So what constitutes enclosing? Here is the list of
/// events that have associated enclosed events that will
/// get copied:
/// <ul>
/// <li>
/// <see cref="JsonToken.START_OBJECT"/>
/// :
/// all events up to and including matching (closing)
/// <see cref="JsonToken.END_OBJECT"/>
/// will be copied
/// </li>
/// <li>
/// <see cref="JsonToken.START_ARRAY"/>
/// all events up to and including matching (closing)
/// <see cref="JsonToken.END_ARRAY"/>
/// will be copied
/// </li>
/// <li>
/// <see cref="JsonToken.FIELD_NAME"/>
/// the logical value (which
/// can consist of a single scalar value; or a sequence of related
/// events for structured types (Json Arrays, Objects)) will
/// be copied along with the name itself. So essentially the
/// whole <b>field entry</b> (name and value) will be copied.
/// </li>
/// </ul>
/// <p>
/// After calling this method, parser will point to the
/// <b>last event</b> that was copied. This will either be
/// the event parser already pointed to (if there were no
/// enclosed events), or the last enclosed event copied.
/// </remarks>
/// <exception cref="System.IO.IOException"/>
public virtual void copyCurrentStructure(com.fasterxml.jackson.core.JsonParser jp
)
{
com.fasterxml.jackson.core.JsonToken t = jp.getCurrentToken();
if (t == null)
{
_reportError("No current event to copy");
}
// Let's handle field-name separately first
int id = t.id();
if (id == JsonTokenIdConstants.ID_FIELD_NAME)
{
writeFieldName(jp.getCurrentName());
t = jp.nextToken();
id = t.id();
}
switch (id)
{
case JsonTokenIdConstants.ID_START_OBJECT:
{
// fall-through to copy the associated value
writeStartObject();
while (jp.nextToken() != com.fasterxml.jackson.core.JsonToken.END_OBJECT)
{
copyCurrentStructure(jp);
}
writeEndObject();
break;
}
case JsonTokenIdConstants.ID_START_ARRAY:
{
writeStartArray();
while (jp.nextToken() != com.fasterxml.jackson.core.JsonToken.END_ARRAY)
{
copyCurrentStructure(jp);
}
writeEndArray();
break;
}
default:
{
copyCurrentEvent(jp);
break;
}
}
}
示例2: copyCurrentEvent
/*
/**********************************************************
/* Public API, copy-through methods
/**********************************************************
*/
/// <summary>
/// Method for copying contents of the current event that
/// the given parser instance points to.
/// </summary>
/// <remarks>
/// Method for copying contents of the current event that
/// the given parser instance points to.
/// Note that the method <b>will not</b> copy any other events,
/// such as events contained within Json Array or Object structures.
/// <p>
/// Calling this method will not advance the given
/// parser, although it may cause parser to internally process
/// more data (if it lazy loads contents of value events, for example)
/// </remarks>
/// <exception cref="System.IO.IOException"/>
public virtual void copyCurrentEvent(com.fasterxml.jackson.core.JsonParser jp)
{
com.fasterxml.jackson.core.JsonToken t = jp.getCurrentToken();
// sanity check; what to do?
if (t == null)
{
_reportError("No current event to copy");
}
switch (t.id())
{
case JsonTokenIdConstants.ID_NOT_AVAILABLE:
{
_reportError("No current event to copy");
goto case JsonTokenIdConstants.ID_START_OBJECT;
}
case JsonTokenIdConstants.ID_START_OBJECT:
{
writeStartObject();
break;
}
case JsonTokenIdConstants.ID_END_OBJECT:
{
writeEndObject();
break;
}
case JsonTokenIdConstants.ID_START_ARRAY:
{
writeStartArray();
break;
}
case JsonTokenIdConstants.ID_END_ARRAY:
{
writeEndArray();
break;
}
case JsonTokenIdConstants.ID_FIELD_NAME:
{
writeFieldName(jp.getCurrentName());
break;
}
case JsonTokenIdConstants.ID_STRING:
{
if (jp.hasTextCharacters())
{
writeString(jp.getTextCharacters(), jp.getTextOffset(), jp.getTextLength());
}
else
{
writeString(jp.getText());
}
break;
}
case JsonTokenIdConstants.ID_NUMBER_INT:
{
com.fasterxml.jackson.core.JsonParser.NumberType n = jp.getNumberType();
if (n == com.fasterxml.jackson.core.JsonParser.NumberType.INT)
{
writeNumber(jp.getIntValue());
}
else
{
if (n == com.fasterxml.jackson.core.JsonParser.NumberType.BIG_INTEGER)
{
writeNumber(jp.getBigIntegerValue());
}
else
{
writeNumber(jp.getLongValue());
}
}
break;
}
//.........这里部分代码省略.........