private PrimitiveShortArrayJsonDeserializer() { }
@Override
public short[] doDeserializeArray( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
JsArrayInteger jsArray = JsArrayInteger.createArray().cast();
reader.beginArray();
while ( JsonToken.END_ARRAY != reader.peek() ) {
if ( JsonToken.NULL == reader.peek() ) {
reader.skipValue();
jsArray.push( DEFAULT );
} else {
jsArray.push( reader.nextInt() );
}
}
reader.endArray();
if ( GWT.isScript() ) {
return reinterpretCast( jsArray );
} else {
int length = jsArray.length();
short[] ret = new short[length];
for ( int i = 0; i < length; i++ ) {
ret[i] = (short) jsArray.get( i );
}
return ret;
}
}