コード例 #1
0
 /**
  * 
  *
  * @param SerializationStreamReader $streamReader
  * @param HashMap $instance
  * @throws SerializationException 
  */
 public static function deserialize(SerializationStreamReader $streamReader, $instance)
 {
     $consuming_type = 0;
     // HashMap
     if ($instance instanceof HashMap) {
         $consuming_type = 0;
     } else {
         if (is_array($instance)) {
             $consuming_type = 1;
         } else {
             require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php';
             throw new SerializationException("Error occurred while deserialize HashMap: " . "HashMap_CustomFieldSerializer deserialize only array() or HashMap object, but given: " . gettype($instance));
         }
     }
     $size = $streamReader->readInt();
     for ($i = 0; $i < $size; ++$i) {
         /*Object*/
         $key = $streamReader->readObject();
         /*Object*/
         $value = $streamReader->readObject();
         if (0 == $consuming_type) {
             $instance->put($key, $value);
         } else {
             if (!FORCE_CAST_TO_PHP_PRIMITIVE_TYPES || is_object($key)) {
                 echo $key . ' : ' . gettype($key);
                 require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php';
                 throw new SerializationException("Error occurred while casting native php array to HashMap: " . "HashMap_CustomFieldSerializer serialize only array() where" . " keys object are mapped by one of following types:" . " java.lang.String, java.lang.Byte, java.lang.Character, java.lang.Double, " . "java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short , but given: " . gettype($key));
             }
             $instance[$key] = $value;
         }
     }
 }
コード例 #2
0
 /**
  *
  * @param SerializationStreamReader $streamReader
  * @param ArrayList<Object> $instance
  * @throws SerializationException 
  */
 public static function deserialize(SerializationStreamReader $streamReader, $instance, $consuming_type, $name)
 {
     if ($consuming_type < 0) {
         require_once GWTPHP_DIR . '/maps/java/lang/SerializationException.class.php';
         throw new SerializationException("Error occurred while deserialize {$name}: " . $name . "_CustomFieldSerializer deserialize only array() or " . "{$name} object, but given: " . gettype($instance));
     }
     $size = $streamReader->readInt();
     for ($i = 0; $i < $size; ++$i) {
         /*Object*/
         $obj = $streamReader->readObject();
         if (0 == $consuming_type) {
             $instance->add($obj);
         } else {
             $instance[$i] = $obj;
         }
     }
 }
コード例 #3
0
 /**
  * Enter description here...
  * @throws SerializationException
  * 
  * @return Long
  */
 public static function instantiate(SerializationStreamReader $streamReader)
 {
     return FORCE_CAST_TO_PHP_PRIMITIVE_TYPES ? $streamReader->readLong() : new Long($streamReader->readLong());
     //		return $streamReader->readLong();
 }
コード例 #4
0
 /**
  * Enter description here...
  * @throws SerializationException
  * 
  * @return Boolean
  */
 public static function instantiate(SerializationStreamReader $streamReader)
 {
     return FORCE_CAST_TO_PHP_PRIMITIVE_TYPES ? $streamReader->readBoolean() : new Boolean($streamReader->readBoolean());
 }
コード例 #5
0
 public function readNext(SerializationStreamReader $reader)
 {
     return $reader->readString();
 }
 /**
  * 
  *
  * @param SerializationStreamReader $streamReader
  * @param unknown_type $instance
  * @throws SerializationException
  */
 public static function deserialize(SerializationStreamReader $streamReader, $instance)
 {
     for ($itemIndex = 0; $itemIndex < count($instance); ++$itemIndex) {
         $instance[$itemIndex] = $streamReader->readBoolean();
     }
 }
コード例 #7
0
 public static function instanciate(SerializationStreamReader $streamReader)
 {
     return new Date($streamReader->readLong());
 }
コード例 #8
0
 public static function transform(SerializationStreamReader $streamReader)
 {
     return $streamReader->readString();
 }
コード例 #9
0
 public static function transform(SerializationStreamReader $streamReader)
 {
     $size = $streamReader->readInt();
     $result = array();
     for ($i = 0; $i < $size; $i++) {
         $obj = $streamReader->readObject();
         $value = $streamReader->readObject();
         $result[$obj] = $value;
     }
     return $result;
 }
コード例 #10
0
 /**
  * Enter description here...
  *
  * @param SerializationStreamReader $streamReader
  * @return long
  * @throws SerializationException
  */
 public static function instantiate(SerializationStreamReader $streamReader)
 {
     $long = $streamReader->readLong();
     Logger::getLogger('Date_CustomFieldSerializer')->debug("instantine date" . $long);
     return $long;
 }