Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save plokhotnyuk/1e2ee19d3cc80c3644bc9e453c8aae77 to your computer and use it in GitHub Desktop.
Save plokhotnyuk/1e2ee19d3cc80c3644bc9e453c8aae77 to your computer and use it in GitHub Desktop.
Long method with lookup/table switch, that generated by Scala macros
private[this] def d10(in: JsonReader, default: com.github.plokhotnyuk.jsoniter_scala.macros.User): com.github.plokhotnyuk.jsoniter_scala.macros.User = if (in.isNextToken('{'))
{
var _id: Long = 0L;
var _id_str: String = null;
var _name: String = null;
var _screen_name: String = null;
var _location: String = null;
var _description: String = null;
var _url: String = null;
var _entities: com.github.plokhotnyuk.jsoniter_scala.macros.UserEntities = null;
var _protected: Boolean = false;
var _followers_count: Int = 0;
var _friends_count: Int = 0;
var _listed_count: Int = 0;
var _created_at: String = null;
var _favourites_count: Int = 0;
var _utc_offset: Int = 0;
var _time_zone: String = null;
var _geo_enabled: Boolean = false;
var _verified: Boolean = false;
var _statuses_count: Int = 0;
var _lang: String = null;
var _contributors_enabled: Boolean = false;
var _is_translator: Boolean = false;
var _is_translation_enabled: Boolean = false;
var _profile_background_color: String = null;
var _profile_background_image_url: String = null;
var _profile_background_image_url_https: String = null;
var _profile_background_tile: Boolean = false;
var _profile_image_url: String = null;
var _profile_image_url_https: String = null;
var _profile_banner_url: String = null;
var _profile_link_color: String = null;
var _profile_sidebar_border_color: String = null;
var _profile_sidebar_fill_color: String = null;
var _profile_text_color: String = null;
var _profile_use_background_image: Boolean = false;
var _has_extended_profile: Boolean = false;
var _default_profile: Boolean = false;
var _default_profile_image: Boolean = false;
var _following: Boolean = false;
var _follow_request_sent: Boolean = false;
var _notifications: Boolean = false;
var _translator_type: String = null;
var p0 = -1;
var p1 = 1023;
if (in.isNextToken('}').`unary_!`)
{
in.rollbackToken();
do
{
val l = in.readKeyAsCharBuf();
(in.charBufToHashCode(l): @switch) match {
case 3355 => if (in.isCharBufEqualsTo(l, "id"))
{
if (p0.&(1).!=(0))
p0.^=(1)
else
in.duplicatedKeyError(l);
_id = in.readLong()
}
else
in.skip()
case -1193609971 => if (in.isCharBufEqualsTo(l, "id_str"))
{
if (p0.&(2).!=(0))
p0.^=(2)
else
in.duplicatedKeyError(l);
_id_str = in.readString(_id_str)
}
else
in.skip()
case 3373707 => if (in.isCharBufEqualsTo(l, "name"))
{
if (p0.&(4).!=(0))
p0.^=(4)
else
in.duplicatedKeyError(l);
_name = in.readString(_name)
}
else
in.skip()
case -43264386 => if (in.isCharBufEqualsTo(l, "screen_name"))
{
if (p0.&(8).!=(0))
p0.^=(8)
else
in.duplicatedKeyError(l);
_screen_name = in.readString(_screen_name)
}
else
in.skip()
case 1901043637 => if (in.isCharBufEqualsTo(l, "location"))
{
if (p0.&(16).!=(0))
p0.^=(16)
else
in.duplicatedKeyError(l);
_location = in.readString(_location)
}
else
in.skip()
case -1724546052 => if (in.isCharBufEqualsTo(l, "description"))
{
if (p0.&(32).!=(0))
p0.^=(32)
else
in.duplicatedKeyError(l);
_description = in.readString(_description)
}
else
in.skip()
case 116079 => if (in.isCharBufEqualsTo(l, "url"))
{
if (p0.&(64).!=(0))
p0.^=(64)
else
in.duplicatedKeyError(l);
_url = in.readString(_url)
}
else
in.skip()
case -2102114367 => if (in.isCharBufEqualsTo(l, "entities"))
{
if (p0.&(128).!=(0))
p0.^=(128)
else
in.duplicatedKeyError(l);
_entities = d11(in, _entities)
}
else
in.skip()
case -608539730 => if (in.isCharBufEqualsTo(l, "protected"))
{
if (p0.&(256).!=(0))
p0.^=(256)
else
in.duplicatedKeyError(l);
_protected = in.readBoolean()
}
else
in.skip()
case -460163995 => if (in.isCharBufEqualsTo(l, "followers_count"))
{
if (p0.&(512).!=(0))
p0.^=(512)
else
in.duplicatedKeyError(l);
_followers_count = in.readInt()
}
else
in.skip()
case -1666926107 => if (in.isCharBufEqualsTo(l, "friends_count"))
{
if (p0.&(1024).!=(0))
p0.^=(1024)
else
in.duplicatedKeyError(l);
_friends_count = in.readInt()
}
else
in.skip()
case -1974943731 => if (in.isCharBufEqualsTo(l, "listed_count"))
{
if (p0.&(2048).!=(0))
p0.^=(2048)
else
in.duplicatedKeyError(l);
_listed_count = in.readInt()
}
else
in.skip()
case 1369680106 => if (in.isCharBufEqualsTo(l, "created_at"))
{
if (p0.&(4096).!=(0))
p0.^=(4096)
else
in.duplicatedKeyError(l);
_created_at = in.readString(_created_at)
}
else
in.skip()
case 226316666 => if (in.isCharBufEqualsTo(l, "favourites_count"))
{
if (p0.&(8192).!=(0))
p0.^=(8192)
else
in.duplicatedKeyError(l);
_favourites_count = in.readInt()
}
else
in.skip()
case 1699658638 => if (in.isCharBufEqualsTo(l, "utc_offset"))
{
if (p0.&(16384).!=(0))
p0.^=(16384)
else
in.duplicatedKeyError(l);
_utc_offset = in.readInt()
}
else
in.skip()
case 36848094 => if (in.isCharBufEqualsTo(l, "time_zone"))
{
if (p0.&(32768).!=(0))
p0.^=(32768)
else
in.duplicatedKeyError(l);
_time_zone = in.readString(_time_zone)
}
else
in.skip()
case -1085743021 => if (in.isCharBufEqualsTo(l, "geo_enabled"))
{
if (p0.&(65536).!=(0))
p0.^=(65536)
else
in.duplicatedKeyError(l);
_geo_enabled = in.readBoolean()
}
else
in.skip()
case -1994383672 => if (in.isCharBufEqualsTo(l, "verified"))
{
if (p0.&(131072).!=(0))
p0.^=(131072)
else
in.duplicatedKeyError(l);
_verified = in.readBoolean()
}
else
in.skip()
case -1824078800 => if (in.isCharBufEqualsTo(l, "statuses_count"))
{
if (p0.&(262144).!=(0))
p0.^=(262144)
else
in.duplicatedKeyError(l);
_statuses_count = in.readInt()
}
else
in.skip()
case 3314158 => if (in.isCharBufEqualsTo(l, "lang"))
{
if (p0.&(524288).!=(0))
p0.^=(524288)
else
in.duplicatedKeyError(l);
_lang = in.readString(_lang)
}
else
in.skip()
case 647263482 => if (in.isCharBufEqualsTo(l, "contributors_enabled"))
{
if (p0.&(1048576).!=(0))
p0.^=(1048576)
else
in.duplicatedKeyError(l);
_contributors_enabled = in.readBoolean()
}
else
in.skip()
case 583435343 => if (in.isCharBufEqualsTo(l, "is_translator"))
{
if (p0.&(2097152).!=(0))
p0.^=(2097152)
else
in.duplicatedKeyError(l);
_is_translator = in.readBoolean()
}
else
in.skip()
case 1690715422 => if (in.isCharBufEqualsTo(l, "is_translation_enabled"))
{
if (p0.&(4194304).!=(0))
p0.^=(4194304)
else
in.duplicatedKeyError(l);
_is_translation_enabled = in.readBoolean()
}
else
in.skip()
case 1592986856 => if (in.isCharBufEqualsTo(l, "profile_background_color"))
{
if (p0.&(8388608).!=(0))
p0.^=(8388608)
else
in.duplicatedKeyError(l);
_profile_background_color = in.readString(_profile_background_color)
}
else
in.skip()
case -1189803120 => if (in.isCharBufEqualsTo(l, "profile_background_image_url"))
{
if (p0.&(16777216).!=(0))
p0.^=(16777216)
else
in.duplicatedKeyError(l);
_profile_background_image_url = in.readString(_profile_background_image_url)
}
else
in.skip()
case 594447228 => if (in.isCharBufEqualsTo(l, "profile_background_image_url_https"))
{
if (p0.&(33554432).!=(0))
p0.^=(33554432)
else
in.duplicatedKeyError(l);
_profile_background_image_url_https = in.readString(_profile_background_image_url_https)
}
else
in.skip()
case 1021718665 => if (in.isCharBufEqualsTo(l, "profile_background_tile"))
{
if (p0.&(67108864).!=(0))
p0.^=(67108864)
else
in.duplicatedKeyError(l);
_profile_background_tile = in.readBoolean()
}
else
in.skip()
case -174080651 => if (in.isCharBufEqualsTo(l, "profile_image_url"))
{
if (p0.&(134217728).!=(0))
p0.^=(134217728)
else
in.duplicatedKeyError(l);
_profile_image_url = in.readString(_profile_image_url)
}
else
in.skip()
case -782008927 => if (in.isCharBufEqualsTo(l, "profile_image_url_https"))
{
if (p0.&(268435456).!=(0))
p0.^=(268435456)
else
in.duplicatedKeyError(l);
_profile_image_url_https = in.readString(_profile_image_url_https)
}
else
in.skip()
case -690137550 => if (in.isCharBufEqualsTo(l, "profile_banner_url"))
{
if (p0.&(536870912).!=(0))
p0.^=(536870912)
else
in.duplicatedKeyError(l);
_profile_banner_url = in.readString(_profile_banner_url)
}
else
in.skip()
case 1512257332 => if (in.isCharBufEqualsTo(l, "profile_link_color"))
{
if (p0.&(1073741824).!=(0))
p0.^=(1073741824)
else
in.duplicatedKeyError(l);
_profile_link_color = in.readString(_profile_link_color)
}
else
in.skip()
case -1412739479 => if (in.isCharBufEqualsTo(l, "profile_sidebar_border_color"))
{
if (p0.&(-2147483648).!=(0))
p0.^=(-2147483648)
else
in.duplicatedKeyError(l);
_profile_sidebar_border_color = in.readString(_profile_sidebar_border_color)
}
else
in.skip()
case 486184128 => if (in.isCharBufEqualsTo(l, "profile_sidebar_fill_color"))
{
if (p1.&(1).!=(0))
p1.^=(1)
else
in.duplicatedKeyError(l);
_profile_sidebar_fill_color = in.readString(_profile_sidebar_fill_color)
}
else
in.skip()
case -1774134745 => if (in.isCharBufEqualsTo(l, "profile_text_color"))
{
if (p1.&(2).!=(0))
p1.^=(2)
else
in.duplicatedKeyError(l);
_profile_text_color = in.readString(_profile_text_color)
}
else
in.skip()
case -101767272 => if (in.isCharBufEqualsTo(l, "profile_use_background_image"))
{
if (p1.&(4).!=(0))
p1.^=(4)
else
in.duplicatedKeyError(l);
_profile_use_background_image = in.readBoolean()
}
else
in.skip()
case 284519336 => if (in.isCharBufEqualsTo(l, "has_extended_profile"))
{
if (p1.&(8).!=(0))
p1.^=(8)
else
in.duplicatedKeyError(l);
_has_extended_profile = in.readBoolean()
}
else
in.skip()
case -312724053 => if (in.isCharBufEqualsTo(l, "default_profile"))
{
if (p1.&(16).!=(0))
p1.^=(16)
else
in.duplicatedKeyError(l);
_default_profile = in.readBoolean()
}
else
in.skip()
case 545330631 => if (in.isCharBufEqualsTo(l, "default_profile_image"))
{
if (p1.&(32).!=(0))
p1.^=(32)
else
in.duplicatedKeyError(l);
_default_profile_image = in.readBoolean()
}
else
in.skip()
case 765915793 => if (in.isCharBufEqualsTo(l, "following"))
{
if (p1.&(64).!=(0))
p1.^=(64)
else
in.duplicatedKeyError(l);
_following = in.readBoolean()
}
else
in.skip()
case 585125142 => if (in.isCharBufEqualsTo(l, "follow_request_sent"))
{
if (p1.&(128).!=(0))
p1.^=(128)
else
in.duplicatedKeyError(l);
_follow_request_sent = in.readBoolean()
}
else
in.skip()
case 1272354024 => if (in.isCharBufEqualsTo(l, "notifications"))
{
if (p1.&(256).!=(0))
p1.^=(256)
else
in.duplicatedKeyError(l);
_notifications = in.readBoolean()
}
else
in.skip()
case -475640257 => if (in.isCharBufEqualsTo(l, "translator_type"))
{
if (p1.&(512).!=(0))
p1.^=(512)
else
in.duplicatedKeyError(l);
_translator_type = in.readString(_translator_type)
}
else
in.skip()
case _ => in.skip()
}
}
while (in.isNextToken(',')) ;
if (in.isCurrentToken('}').`unary_!`)
in.objectEndOrCommaError()
else
()
}
else
();
if (p0.&(-1).!=(0))
in.requiredFieldError(f3(Integer.numberOfTrailingZeros(p0)))
else
();
if (p1.&(1023).!=(0))
in.requiredFieldError(f3(Integer.numberOfTrailingZeros(p1).+(32)))
else
();
new com.github.plokhotnyuk.jsoniter_scala.macros.User(id = _id, id_str = _id_str, name = _name, screen_name = _screen_name, location = _location, description = _description, url = _url, entities = _entities, `protected` = _protected, followers_count = _followers_count, friends_count = _friends_count, listed_count = _listed_count, created_at = _created_at, favourites_count = _favourites_count, utc_offset = _utc_offset, time_zone = _time_zone, geo_enabled = _geo_enabled, verified = _verified, statuses_count = _statuses_count, lang = _lang, contributors_enabled = _contributors_enabled, is_translator = _is_translator, is_translation_enabled = _is_translation_enabled, profile_background_color = _profile_background_color, profile_background_image_url = _profile_background_image_url, profile_background_image_url_https = _profile_background_image_url_https, profile_background_tile = _profile_background_tile, profile_image_url = _profile_image_url, profile_image_url_https = _profile_image_url_https, profile_banner_url = _profile_banner_url, profile_link_color = _profile_link_color, profile_sidebar_border_color = _profile_sidebar_border_color, profile_sidebar_fill_color = _profile_sidebar_fill_color, profile_text_color = _profile_text_color, profile_use_background_image = _profile_use_background_image, has_extended_profile = _has_extended_profile, default_profile = _default_profile, default_profile_image = _default_profile_image, following = _following, follow_request_sent = _follow_request_sent, notifications = _notifications, translator_type = _translator_type)
}
else
in.readNullOrTokenError(default, '{');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment