2
0

JSONToken.as 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. Copyright (c) 2008, Adobe Systems Incorporated
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. * Redistributions of source code must retain the above copyright notice,
  8. this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. * Neither the name of Adobe Systems Incorporated nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  16. IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  17. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  18. PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  19. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  20. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  22. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. package com.adobe.serialization.json {
  28. public class JSONToken {
  29. private var _type:int;
  30. private var _value:Object;
  31. /**
  32. * Creates a new JSONToken with a specific token type and value.
  33. *
  34. * @param type The JSONTokenType of the token
  35. * @param value The value of the token
  36. * @langversion ActionScript 3.0
  37. * @playerversion Flash 9.0
  38. * @tiptext
  39. */
  40. public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
  41. _type = type;
  42. _value = value;
  43. }
  44. /**
  45. * Returns the type of the token.
  46. *
  47. * @see com.adobe.serialization.json.JSONTokenType
  48. * @langversion ActionScript 3.0
  49. * @playerversion Flash 9.0
  50. * @tiptext
  51. */
  52. public function get type():int {
  53. return _type;
  54. }
  55. /**
  56. * Sets the type of the token.
  57. *
  58. * @see com.adobe.serialization.json.JSONTokenType
  59. * @langversion ActionScript 3.0
  60. * @playerversion Flash 9.0
  61. * @tiptext
  62. */
  63. public function set type( value:int ):void {
  64. _type = value;
  65. }
  66. /**
  67. * Gets the value of the token
  68. *
  69. * @see com.adobe.serialization.json.JSONTokenType
  70. * @langversion ActionScript 3.0
  71. * @playerversion Flash 9.0
  72. * @tiptext
  73. */
  74. public function get value():Object {
  75. return _value;
  76. }
  77. /**
  78. * Sets the value of the token
  79. *
  80. * @see com.adobe.serialization.json.JSONTokenType
  81. * @langversion ActionScript 3.0
  82. * @playerversion Flash 9.0
  83. * @tiptext
  84. */
  85. public function set value ( v:Object ):void {
  86. _value = v;
  87. }
  88. }
  89. }