public function getOperableFields(Clazz $clazz)
 {
     return SerializabilityUtil::applyFieldSerializationPolicy($clazz);
 }
 private function deserializeWithDefaultFieldDeserializer(MappedClass $instanceClass, $instance)
 {
     /*MappedField[]*/
     $declFields = $instanceClass->getDeclaredFields();
     /*MappedField[]*/
     $serializableFields = SerializabilityUtil::applyFieldSerializationPolicy($declFields);
     foreach ($serializableFields as $declField) {
         $value = $this->deserializeValue($declField->getType());
         $propName = $declField->getName();
         $rClass = $instanceClass->getReflectionClass();
         if ($rClass == null) {
             throw new ClassNotFoundException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains ReflectionClass infomration');
         }
         if (!$rClass->hasProperty($propName)) {
             throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains property: ' . $propName . ' Did you mapped all properties?');
         }
         $rProperty = $rClass->getProperty($propName);
         if ($rProperty->isPublic()) {
             $rProperty->setValue($instance, $value);
         } else {
             // not public access to property, we try invoke setter method
             $propNameSetter = 'set' . strtoupper($propName[0]) . substr($propName, 1, strlen($propName));
             if (!$rClass->hasMethod($propNameSetter)) {
                 throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains setter method for private property: ' . $propName . '. Mapped object should be in pojo style?');
             }
             $rMethod = $rClass->getMethod($propNameSetter);
             if ($rMethod->isPublic()) {
                 $rMethod->invoke($instance, $value);
             } else {
                 throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains public setter method for private property: ' . $propName . '. Mapped object should be in pojo style?');
             }
         }
         /*
         	Object value = deserializeValue(declField.getType());
         
         	boolean isAccessible = declField.isAccessible();
         	boolean needsAccessOverride = !isAccessible
         	  && !Modifier.isPublic(declField.getModifiers());
         	if (needsAccessOverride) {
         	// Override access restrictions
         	declField.setAccessible(true);
         	}
         	
         	declField.set(instance, value);
         	
         	if (needsAccessOverride) {
         	// Restore access restrictions
         	declField.setAccessible(isAccessible);
         	}
         */
     }
     $superClass = $instanceClass->getSuperclass();
     if ($superClass != null && $this->getSerializationPolicy()->shouldDeserializeFields($superClass)) {
         $this->deserializeImpl(SerializabilityUtil::hasCustomFieldSerializer($superClass), $superClass, $instance);
     }
     /*
     Class<?> superClass = instanceClass.getSuperclass();
     	    if (serializationPolicy.shouldDeserializeFields(superClass)) {
     	      deserializeImpl(SerializabilityUtil.hasCustomFieldSerializer(superClass),
     	          superClass, instance);
     	    }
     */
 }
 /**
  *
  *
  * @param Object $instance
  * @param MappedClass $instanceClass
  * @ throws SerializationException
  */
 private function serializeClass($instance, MappedClass $instanceClass)
 {
     assert($instance != null);
     /*MappedField[]*/
     $declFields = $instanceClass->getDeclaredFields();
     /*MappedField[]*/
     $serializableFields = SerializabilityUtil::applyFieldSerializationPolicy($declFields);
     foreach ($serializableFields as $declField) {
         assert($declField != null);
         $value = null;
         $propName = $declField->getName();
         $rClass = $instanceClass->getReflectionClass();
         //$rClass = new ReflectionObject($instance);
         if ($rClass == null) {
             throw new ClassNotFoundException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains ReflectionClass infomration');
         }
         if (!$rClass->hasProperty($propName)) {
             throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains property: ' . $propName . ' Did you mapped all properties?');
         }
         $rProperty = $rClass->getProperty($propName);
         if ($rProperty->isPublic()) {
             $value = $rProperty->getValue($instance);
         } else {
             // not public access to property, we try invoke getter method
             $propNameSetter = 'get' . strtoupper($propName[0]) . substr($propName, 1, strlen($propName));
             if (!$rClass->hasMethod($propNameSetter)) {
                 throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains getter method for private property: ' . $propName . '. Mapped object should be in pojo style?');
             }
             $rMethod = $rClass->getMethod($propNameSetter);
             if ($rMethod->isPublic()) {
                 $value = $rMethod->invoke($instance);
             } else {
                 throw new SerializationException('MappedClass: ' . $instanceClass->getSignature() . ' do not contains public getter method for private property: ' . $propName . '. Mapped object should be in pojo style?');
             }
         }
         $this->serializeValue($value, $declField->getType());
     }
     /* assert (instance != null);
     
     		Field[] declFields = instanceClass.getDeclaredFields();
     		Field[] serializableFields = SerializabilityUtil.applyFieldSerializationPolicy(declFields);
     		for (Field declField : serializableFields) {
     		assert (declField != null);
     
     		boolean isAccessible = declField.isAccessible();
     		boolean needsAccessOverride = !isAccessible
     		&& !Modifier.isPublic(declField.getModifiers());
     		if (needsAccessOverride) {
     		// Override the access restrictions
     		declField.setAccessible(true);
     		}
     
     		Object value;
     		try {
     		value = declField.get(instance);
     		serializeValue(value, declField.getType());
     
     		} catch (IllegalArgumentException e) {
     		throw new SerializationException(e);
     
     		} catch (IllegalAccessException e) {
     		throw new SerializationException(e);
     		}
     
     		if (needsAccessOverride) {
     		// Restore the access restrictions
     		declField.setAccessible(isAccessible);
     		}
     		}
     
     		Class<?> superClass = instanceClass.getSuperclass();
     		if (serializationPolicy.shouldSerializeFields(superClass)) {
     		serializeImpl(instance, superClass);
     		}*/
     $superClass = $instanceClass->getSuperclass();
     if ($superClass != null && $this->serializationPolicy->shouldDeserializeFields($superClass)) {
         $this->serializeImpl($instance, $superClass);
     }
 }