Skip to content

Commit

Permalink
Serializable implementation (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Sep 10, 2018
1 parent dadb510 commit 62ea943
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/attributes/serializable.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
/**
* @file gpf.attributes.Serializable attribute class
* @since 0.2.8
*/
/*#ifndef(UMD)*/
"use strict";
/*global _gpfDefine*/ // Shortcut for gpf.define
/*global _gpfAttribute*/ // Shortcut for gpf.attributes.Attribute
/*global _gpfAttributesMemberAttribute*/ // Shortcut for gpf.attributes.MemberAttribute
/*global _gpfAttributesUniqueAttribute*/ // Shortcut for gpf.attributes.UniqueAttribute
/*global _gpfDefine*/ // Shortcut for gpf.define
/*global _gpfSerialPropertyCheck*/ // Check that the serializable property definition is valid
/*exported _gpfAttributesSerializable*/ // Shortcut for gpf.attributes.Serializable
/*#endif*/

var _gpfAttributesSerializable = _gpfDefine({
$class: "gpf.attributes.Serializable",
$extend: _gpfAttribute,
// $attributes: [new gpf.attributes.MemberAttribute(), new gpf.attributes.Unique()]
$attributes: [new _gpfAttributesMemberAttribute(), new _gpfAttributesUniqueAttribute()],

/**
* Serializable property definition
*
* @type {gpf.typedef.serializableProperty}
* @since 0.2.8
*/
_property: null,

/**
*
* @param {gpf.typedef.serializableProperty} property
* @param {gpf.typedef.serializableProperty} property Serializable property definition
* @throws {gpf.Error.InvalidSerialName}
* @throws {gpf.Error.InvalidSerialType}
* @throws {gpf.Error.InvalidSerialRequired}
* @constructor gpf.attributes.Serializable
* @extends gpf.attributes.Attribute
* @since 0.2.8
*/
constructor: function (property) {
_gpfSerialPropertyCheck(property);
this._property = property;
this._property = _gpfSerialPropertyCheck(property);
},

/** gpf:read _property */
/**
* @gpf:read _property
* @since 0.2.8
*/
getProperty: function () {
return Object.create(this._property);
}
Expand Down

0 comments on commit 62ea943

Please sign in to comment.