DataBags.contentsFunction
DataBags.contents(A)

yields the contents associated with an instance A of a sub-type of DataBags.AbstractDataBag or of AbstractDict.

This method should be specialized by types derived from DataBags.AbstractDataBag, this is the most simple way to inherit of the common behavior implemented by this abstract type.

The contents method is also meant to be called by data-bag constructors to create a new dictionary out of their arguments. For that usage, the syntax is:

content(Dict{K,V}, args...; kwds...) -> Dict

which yields a new dictionary built out of arguments args and keywords kwds and accounting for type constraints set by K and V for respectively the keys and values of the returned dictionary. Types K and/or V can be `Any if no type constraints are imposed.

DataBags.propertynameMethod
DataBags.propertyname(T, sym)

converts symbol sym to a suitable key for data-bag of type T (a sub-type of DataBags.AbstractDataBag), throwing an error if this conversion is not supported.

DataBags.wrapMethod
wrap(T::Type{<:AbstractDataBag}, arg) -> obj::T

wraps argument arg in a data-bag of type T. The returned object shares its contents with arg.

This method can be used to build a data-bag from an existing dictionary without duplicating the dictionary. As an example:

dict = Dict{Symbol,Any}(:a => 1, :foo => "bar")
cont = wrap(DataBag, dict)
cont.b = 33
dict["b"] == 33 # yields `true`

If the statement wrap(DataBag, dict) is replaced by DataBag(dict), the result of the last statement is false.

DataBags.@newtypeMacro
DataBags.@newtype T

creates a new data-bag type T which is a sub-type of DataBags.AbstractDataBag with symbolic keys and values of Any type.