function bos/meta/attribute/store-for-into() {
local bos_meta_attribute_class bos_meta_attribute_objid
bos-object/unpack-self-into bos_meta_attribute_class bos_meta_attribute_objid "$2"
if [[ -z "$attribute_name" ]]; then
local bos_meta_attribute_get_name; $self get-attribute-name-into bos_meta_attribute_get_name
local bos_meta_attribute_get_type; $self get-attribute-type-into bos_meta_attribute_get_type
local bos_meta_attribute_get_class; $self get-associated-class-into bos_meta_attribute_get_class
local attribute_name="$bos_meta_attribute_get_name"
local attribute_type="$bos_meta_attribute_get_type"
local associated_class="$bos_meta_attribute_get_class"
fi
"bos-namespaces/store-${attribute_type}-for-into" "$1" attribute "$attribute_name" "$associated_class" "$bos_meta_attribute_class" "$bos_meta_attribute_objid"
}
function bos/meta/attribute/get-attribute-name-into() {
local attribute_type='scalar'
local associated_class='bos/meta/attribute'
local bos_meta_attribute_name_store
local attribute_name='attribute_name'
bos/meta/attribute/store-for-into bos_meta_attribute_name_store "$self"
local -n bos_meta_attribute_name="$bos_meta_attribute_name_store"
bos/log 5 "get-attribute-name-into($1)<-$bos_meta_attribute_name_store"
local -n bos_meta_attribute_name_dest="$1"
bos_meta_attribute_name_dest="$bos_meta_attribute_name"
}
function bos/meta/attribute/get-attribute-type-into() {
local attribute_type='scalar'
local associated_class='bos/meta/attribute'
local bos_meta_attribute_type_store
local attribute_name='attribute_type'
bos/meta/attribute/store-for-into bos_meta_attribute_type_store "$self"
local -n bos_meta_attribute_type="$bos_meta_attribute_type_store"
local -n bos_meta_attribute_type_dest="$1"
bos_meta_attribute_type_dest="$bos_meta_attribute_type"
}
function bos/meta/attribute/get-associated-class-into() {
local attribute_type='scalar'
local associated_class='bos/meta/attribute'
local bos_meta_attribute_class_store
local attribute_name='associated_class'
bos/meta/attribute/store-for-into bos_meta_attribute_class_store "$self"
local -n bos_meta_attribute_class="$bos_meta_attribute_class_store"
local -n bos_meta_attribute_class_dest="$1"
bos_meta_attribute_class_dest="$bos_meta_attribute_class"
}
function bos/meta/attribute/set-value() {
if [[ -z "$attribute_name" ]]; then
local bos_meta_attribute_set_name; $self get-attribute-name-into bos_meta_attribute_set_name
local bos_meta_attribute_set_type; $self get-attribute-type-into bos_meta_attribute_set_type
local bos_meta_attribute_set_class; $self get-associated-class-into bos_meta_attribute_set_class
local attribute_name="$bos_meta_attribute_set_name"
local attribute_type="$bos_meta_attribute_set_type"
local associated_class="$bos_meta_attribute_set_class"
fi
local bos_meta_attribute_store_name; $self store-for-into bos_meta_attribute_store_name "$1"
shift
local -n bos_meta_attribute_store="$bos_meta_attribute_store_name"
case "$attribute_type" in
scalar) bos_meta_attribute_store="$1" ;;
array) bos_meta_attribute_store=( "$@" ) ;;
assoc) eval "bos_meta_attribute_store=( ${@@Q} )" ;;
esac
bos/log 5 "set-value() $(declare -p "$bos_meta_attribute_store_name")"
return 0
}
function bos/meta/attribute/get-value-into() {
local bos_meta_attribute_result_name="$1"
local -n bos_meta_attribute_result="$1"; shift;
local bos_meta_attribute_get_name; $self get-attribute-name-into bos_meta_attribute_get_name
local bos_meta_attribute_get_type; $self get-attribute-type-into bos_meta_attribute_get_type
local bos_meta_attribute_get_class; $self get-associated-class-into bos_meta_attribute_get_class
local attribute_name="$bos_meta_attribute_get_name"
local attribute_type="$bos_meta_attribute_get_type"
local associated_class="$bos_meta_attribute_get_class"
bos/log 5 "getting ($self) ($attribute_name) ($attribute_type) ($associated_class) ($1)"
local bos_meta_attribute_store_name; $self store-for-into bos_meta_attribute_store_name "$1"
local -n bos_meta_attribute_store="$bos_meta_attribute_store_name"
local bos_meta_attribute_value_expr
case "$attribute_type" in
scalar) bos_meta_attribute_result="$bos_meta_attribute_store" ;;
array) bos_meta_attribute_result=( "${bos_meta_attribute_store[@]}" ) ;;
assoc)
bos_meta_attribute_value_expr="$(declare -p "$bos_meta_attribute_store_name")"
[[ "$bos_meta_attribute_value_expr" =~ = ]] || return 0
eval "bos_meta_attribute_result=${bos_meta_attribute_value_expr#*=}"
;;
esac
bos/log 5 "$(declare -p "$bos_meta_attribute_result_name")"
return 0
}