{@inheritDoc}

Serializes the property defined for this instance.
3303
public void serialize( JsonWriter writer, T bean, JsonSerializationContext ctx ) {
        Map map = getValue( bean, ctx );
        if ( null != map ) {
            ((MapJsonSerializer) getSerializer()).serializeValues( writer, map, ctx, getParameters() );
        }
    }
1271236
public function setData($property, $value = null)
    {
        if (is_array($property)) {
            $description = $this->getEntityDescription();
            $properties = $property;
            $access = pick($value, AnDomain::ACCESS_PUBLIC);

            foreach ($properties as $key => $value) {
                $property = $description->getProperty($key);
                if ($property && $property->getWriteAccess() >= $access) {
                    //ignore any type related exceptions
                      try {
                          $this->setData($property->getName(), $value);
                      } catch (AnDomainExceptionType $e) {
                          print $e->getMessage();
                          die;
                      }
                } elseif (!$property) {
                    $this->$key = $value;
                }
            }

            return $this;
        } else {
            $name = $property;
            $description = $this->getEntityDescription();
            $property = $description->getProperty($property);

            if (!$property instanceof AnDomainPropertyAbstract) {
                $this->set($name, $value);

                return $this;
            }

            $name = $property->getName();
            $method = 'set'.ucfirst($name);

            if ($this->methodExists($method)) {
                $this->$method($value);
            } else {
                //only set the property if it's not write proteced (write != private )
                if ($property->getWriteAccess() < AnDomain::ACCESS_PROTECTED) {
                    throw new AnException(get_class($this).'::$'.$name.' is write protected');
                }

                $this->set($name, $value);
            }

            return $this;
        }
    }
574699
public function serialize()
    {
        $serialized = $this->__serialize();

        if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
            $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
            $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
        }

        return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
    }
903553
public function unserialize($serialized)
    {
        $data = unserialize($serialized);
        $this->_data = $data['data'];
        $this->_iteratorClass = $data['iteratorClass'];
        parent::__construct();
    }
1034806
protected function serializeProperty(Property $property)
    {
        if ($property->group) {
            $this->cWrite('default', $property->group);
            $this->cWrite('red', '.');
        }

        $this->cWrite('yellow', $property->name);

        foreach ($property->parameters as $param) {
            $this->cWrite('red', ';');
            $this->cWrite('blue', $param->serialize());
        }
        $this->cWrite('red', ':');

        if ($property instanceof Property\Binary) {
            $this->cWrite('default', 'embedded binary stripped. ('.strlen($property->getValue()).' bytes)');
        } else {
            $parts = $property->getParts();
            $first1 = true;
            // Looping through property values
            foreach ($parts as $part) {
                if ($first1) {
                    $first1 = false;
                } else {
                    $this->cWrite('red', $property->delimiter);
                }
                $first2 = true;
                // Looping through property sub-values
                foreach ((array) $part as $subPart) {
                    if ($first2) {
                        $first2 = false;
                    } else {
                        // The sub-value delimiter is always comma
                        $this->cWrite('red', ',');
                    }

                    $subPart = strtr(
                        $subPart,
                        [
                            '\\' => $this->colorize('purple', '\\\\', 'green'),
                            ';' => $this->colorize('purple', '\;', 'green'),
                            ',' => $this->colorize('purple', '\,', 'green'),
                            "\n" => $this->colorize('purple', "\\n\n\t", 'green'),
                            "\r" => '',
                        ]
                    );

                    $this->cWrite('green', $subPart);
                }
            }
        }
        $this->cWrite('default', "\n");
    }
1035613
public function serializeData()
    {
        if (isset($this->_dataObject)) {
            try {
                $this->result = serialize($this->_dataObject);
            } catch (\Exception $e) {
                \d($this->_dataObject);
                exit;
            }
        }
    }
33692
Map<String, Object> serialize() {

		final Map<String, Object> serializedForm       = new TreeMap<>();
		final Map<String, Object> serializedProperties = new TreeMap<>();
		final Map<String, Object> serializedMethods    = new TreeMap<>();

		// populate properties
		for (final StructrPropertyDefinition property : properties) {
			serializedProperties.put(property.getName(), property.serialize());
		}

		// populate methods
		for (final StructrMethodDefinition method : methods) {

			final String name = method.getName();

			if (serializedMethods.containsKey(name)) {

				// Name is already present in the map, so there are at least
				// two method with the same name.
				final Object currentValue = serializedMethods.get(name);
				if (currentValue instanceof Collection) {

					// add serialized method to collection
					final Collection collection = (Collection)currentValue;

					collection.add(method.serialize());

				} else if (currentValue instanceof Map) {

					// remove map, add collection, add
					// map to collection
					final Map<String, Object> otherMethod   = (Map<String, Object>)serializedMethods.get(name);
					final Map<String, Object> currentMethod = method.serialize();
					final List<Map<String, Object>> list    = new LinkedList<>();

					list.add(otherMethod);
					list.add(currentMethod);

					serializedMethods.put(name, list);

				} else {

					logger.warn("Invalid storage datastructure for methods: {}", currentValue.getClass().getName());
				}

			} else {

				serializedMethods.put(method.getName(), method.serialize());
			}
		}

		serializedForm.put(JsonSchema.KEY_TYPE, "object");
		serializedForm.put(JsonSchema.KEY_IS_ABSTRACT, isAbstract);
		serializedForm.put(JsonSchema.KEY_IS_INTERFACE, isInterface);
		if (getClass().equals(StructrNodeTypeDefinition.class)) {
			serializedForm.put(JsonSchema.KEY_IS_BUILTIN_TYPE, isBuiltinType);
		}

		// properties
		if (!serializedProperties.isEmpty()) {
			serializedForm.put(JsonSchema.KEY_PROPERTIES, serializedProperties);
		}

		// required
		final Set<String> requiredProperties = getRequiredProperties();
		if (!requiredProperties.isEmpty()) {
			serializedForm.put(JsonSchema.KEY_REQUIRED, requiredProperties);
		}

		// views
		if (!views.isEmpty()) {

			// FIXME: views are different

			serializedForm.put(JsonSchema.KEY_VIEWS, views);
			serializedForm.put(JsonSchema.KEY_VIEW_ORDER, viewOrder);
		}

		// methods
		if (!serializedMethods.isEmpty()) {
			serializedForm.put(JsonSchema.KEY_METHODS, serializedMethods);
		}

		final URI ext = getExtends();
		if (ext != null) {

			serializedForm.put(JsonSchema.KEY_EXTENDS, root.toJsonPointer(ext));
		}

		if (!implementedInterfaces.isEmpty()) {

			final Set<String> interfaces = new TreeSet<>();

			for (final URI uri : implementedInterfaces) {
				interfaces.add(root.toJsonPointer(uri));
			}

			if (!interfaces.isEmpty()) {
				serializedForm.put(JsonSchema.KEY_IMPLEMENTS, interfaces);
			}
		}

		if (StringUtils.isNotBlank(category)) {
			serializedForm.put(JsonSchema.KEY_CATEGORY, category);
		}

		return serializedForm;
	}
1198667
public function beforePropertyModelSave(Property &$property, $insert)
    {
        if ($property->canTranslate()) {
            $property->data_type = Property::DATA_TYPE_INVARIANT_STRING;
        }
        return parent::beforePropertyModelSave($property, $insert);
    }
626091
public function mergeProperties($object)
    {
        $defaultValues = get_class_vars(get_class($this));
        $currentValues = get_object_vars($this);
        foreach ($object as $property => $value) {
            if ($property === '_context') {
                continue;
            }
            if ($currentValues[$property] === $defaultValues[$property]) { // Overwrite default values
                $this->$property = $value;
                continue;
            }
            if ($property === '_unmerged') {
                $this->_unmerged = array_merge($this->_unmerged, $value);
                continue;
            }
            if ($currentValues[$property] !== $value) { // New value is not the same?
                if ($defaultValues[$property] === $value) { // but is the same as the default?
                    continue; // Keep current, no notice
                }
                $identity = method_exists($object, 'identity') ? $object->identity() : get_class($object);
                $context1 = $this->_context;
                $context2 = property_exists($object, '_context') ? $object->_context : 'unknown';
                if (is_object($this->$property) && $this->$property instanceof AbstractAnnotation) {
                    $context1 = $this->$property->_context;
                }
                Logger::warning('Multiple definitions for ' . $identity . '->' . $property . "\n     Using: " . $context1 . "\n  Skipping: " . $context2);
            }
        }
    }
382870
public function serialize()
    {
        if ($this->getIsModified() || $this->getIsNew()) {
            throw new RuntimeException($this->translate(
                'Cannot serialize modified or new object.'
            ));
        }

        if ($this->collection && $this->type) {
            $this->fullyLoad(true);
        }
        $data = [
            $this->initialValues,
            $this->getCollectionName(),
            $this->getTypeName()
        ];

        return serialize($data);
    }
550027
function serialize (value, columnDefinitions) {

    var serializedValue = {};

    try {
        Validate.notNull(columnDefinitions, 'columnDefinitions');
        Validate.isObject(columnDefinitions);
        
        Validate.notNull(value);
        Validate.isObject(value);

        for (var property in value) {

            var columnType = storeHelper.getColumnType(columnDefinitions, property);
            // Skip properties that don't match any column in the table 
            if (!_.isNull(columnType)) {
                serializedValue[property] = serializeMember(value[property], columnType);
            }
        }
        
    } catch (error) {
        throw new verror.VError(error, 'Failed to serialize value ' + JSON.stringify(value) + '. Column definitions: ' + JSON.stringify(columnDefinitions));
    }

    return serializedValue;
}
1054144
public function serializeProperties()
    {
        $shift = 15;
        $flagBits = 0;
        $flags = array();
        $rawBytes = new Writer();

        foreach ($this->propertyTypes as $key => $proptype) {
            if (isset($this->properties[$key])) {
                $value = $this->properties[$key];
            } else {
                $value = null;
            }

            if ($value != null) {
                if ($shift == 0) {
                    $flags[] = $flagBits;
                    $flagBits = 0;
                    $shift = 15;
                }

                $flagBits |= (1 << $shift);
                if ($proptype != 'bit') {
                    $proptype = ucfirst($proptype);
                    $rawBytes->{'write' . $proptype}($value);
                }

            }
            $shift -= 1;
        }

        $flags[] = $flagBits;
        $result = new Writer();
        foreach ($flags as $flagBits) {
            $result->writeShort($flagBits);
        }

        $result->write($rawBytes->getvalue());

        return $result->getvalue();
    }
1161300
public function serialize($includePrivate=false, $includeInternal=true, $removeNullValues=false,
                              $dateAsISO8601=false)
    {
        $answer = array();
        $schema = $this->_jsonSchema;

        foreach ($schema['definition'] as $property => $definition) {
            $method = 'get' . ucfirst($property);

            //Checking special types
            if ($definition['private'] == true && !$includePrivate) {
                continue;
            }

            if ($definition['internal'] == true && !$includeInternal) {
                continue;
            }

            $valueFromMethod = $this->$method();

            if (isset($definition['type'])) {
                switch ($definition['type']) {
                    case "datetime":
                        if ($dateAsISO8601 && !is_null($valueFromMethod)) {
                            $valueFromMethod = $valueFromMethod->format("c");
                        } else {
                            $valueFromMethod = $this->$property; //Integer value
                        }
                        break;
                }
            }
            $value = StoreHelper::serialize($valueFromMethod, $includePrivate, $includeInternal, $removeNullValues, $dateAsISO8601);

            if (is_null($value)
                && $removeNullValues
                && array_key_exists('validationConstraints', $definition)
                && !$definition['keepIfNull']
                && !(in_array('NotBlank', $definition['validationConstraints']))) {

                continue;
            }

            $answer[$property] = $value;

            /**
             * Add aliases
             */
            if ($definition['alias']) {
                $alias = $definition['alias'];
                $method = 'get' . ucfirst($alias);
                if (method_exists($this, $method)) {
                    $answer[$alias] = $this->$method();
                } else {
                    $answer[$alias] = $answer[$property];
                }
            }
        }

        return (object) $answer;
    }
548173
public function serialize($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Argument must be an object');
        }

        $reflectedObject = new \ReflectionObject($object);
        $reflectedProperties = $reflectedObject->getProperties();

        $array = array();

        foreach ($reflectedProperties as $property) {
            $value = $this->getValue($object, $property);

            if (null !== $value) {
                if (!is_scalar($value)) {
                    $value = $this->normalize($value);
                }

                $array[$this->formatter->toMongoKey($property->getName())] = $value;
            }
        }

        return $array;
    }
1372579
@Override
	public void serialize(BinderContext context, SerializerWrapper serializerWrapper, E object) throws Exception {
		serialize(context, object, serializerWrapper, true);
	}
1167525
public function serialize()
    {
        return serialize(array(
            'autoNumber'              =>  $this->autoNumber,
            'byteLength'              =>  $this->byteLength,
            'calculated'              =>  $this->calculated,
            'calculatedFormula'       =>  $this->calculatedFormula,
            'caseSensitive'           =>  $this->caseSensitive,
            'controllerName'          =>  $this->controllerName,
            'createable'              =>  $this->createable,
            'custom'                  =>  $this->custom,
            'defaultValueFormula'     =>  $this->defaultValueFormula,
            'defaultedOnCreate'       =>  $this->defaultedOnCreate,
            'dependentPicklist'       =>  $this->dependentPicklist,
            'deprecatedAndHidden'     =>  $this->deprecatedAndHidden,
            'digits'                  =>  $this->digits,
            'externalId'              =>  $this->externalId,
            'filterable'              =>  $this->filterable,
            'groupable'               =>  $this->groupable,
            'htmlFormatted'           =>  $this->htmlFormatted,
            'idLookup'                =>  $this->idLookup,
            'inlineHelpText'          =>  $this->inlineHelpText,
            'label'                   =>  $this->label,
            'length'                  =>  $this->length,
            'name'                    =>  $this->name,
            'nameField'               =>  $this->nameField,
            'namePointing'            =>  $this->namePointing,
            'nillable'                =>  $this->nillable,
            'permissionable'          =>  $this->permissionable,
            'picklistValues'          =>  $this->picklistValues,
            'precision'               =>  $this->precision,
            'referenceTo'             =>  $this->referenceTo,
            'relationshipName'        =>  $this->relationshipName,
            'relationshipOrder'       =>  $this->relationshipOrder,
            'restrictedPicklist'      =>  $this->restrictedPicklist,
            'scale'                   =>  $this->scale,
            'soapType'                =>  $this->soapType,
            'sortable'                =>  $this->sortable,
            'type'                    =>  $this->type,
            'unique'                  =>  $this->unique,
            'updateable'              =>  $this->updateable,
            'writeRequiresMasterRead' =>  $this->writeRequiresMasterRead
        ));
    }
986431
public function serialize()
    {
        // In order to be able to properly compare style, set static ID value
        $currentId = $this->id;
        $this->setId(0);

        $serializedStyle = serialize($this);

        $this->setId($currentId);

        return $serializedStyle;
    }