diff --git a/lib/WebGUI/Definition.pm b/lib/WebGUI/Definition.pm index b9b4140e7..eba41e17a 100644 --- a/lib/WebGUI/Definition.pm +++ b/lib/WebGUI/Definition.pm @@ -46,7 +46,7 @@ These methods are available from this class: my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods( install => [ 'unimport' ], - with_meta => [ 'property', 'attribute' ], + with_meta => [ 'property', 'aspect' ], also => 'Moose', ); @@ -87,15 +87,15 @@ sub init_meta { #------------------------------------------------------------------- -=head2 attribute ( ) +=head2 aspect ( ) -An attribute of the definition is typically static data which is never processed from a form -or persisted to the database. In an Asset-style definition, an attribute would +An aspect of the definition is typically static data which is never processed from a form +or persisted to the database. In an Asset-style definition, an aspect would be the table name, the asset's name, or the path to the asset's icon. =cut -sub attribute { +sub aspect { my ($meta, $name, $value) = @_; if ($meta->can($name)) { $meta->$name($value); diff --git a/lib/WebGUI/Definition/Asset.pm b/lib/WebGUI/Definition/Asset.pm index d2e3e1606..dc8b543fb 100644 --- a/lib/WebGUI/Definition/Asset.pm +++ b/lib/WebGUI/Definition/Asset.pm @@ -72,7 +72,7 @@ sub init_meta { =head2 property ( $name, %options ) -Extends WebGUI::Definition::property to copy the tableName attribute from the +Extends WebGUI::Definition::property to copy the tableName aspect from the meta class into the options for each property. =head3 $name diff --git a/lib/WebGUI/Definition/Meta/Class.pm b/lib/WebGUI/Definition/Meta/Class.pm index ee95f3d8f..74b58b81e 100644 --- a/lib/WebGUI/Definition/Meta/Class.pm +++ b/lib/WebGUI/Definition/Meta/Class.pm @@ -46,9 +46,26 @@ These methods are available from this class: #------------------------------------------------------------------- +=head2 get_all_attributes_list ( ) + +Returns an array of all attribute names across all meta classes. + +=cut + +sub get_all_attributes_list { + my $self = shift; + my @attributes = (); + CLASS: foreach my $meta ($self->get_all_class_metas) { + push @attributes, $meta->get_attribute_list; + } + return @attributes; +} + +#------------------------------------------------------------------- + =head2 get_all_class_metas ( ) -Returns an array of all class meta objects for the classes in this class, +Returns an array of all WebGUI::Definition::Meta::Class objects for the classes in this class, in the order they were created in the Definition. =cut @@ -108,7 +125,7 @@ sub get_all_property_list { =head2 get_attributes ( ) Returns an array of all attributes, but only for this class. This is the -API-safe way of doing $self->_attribute_map; +API-safe way of doing values %{ $self->_attribute_map }; =cut diff --git a/lib/WebGUI/Definition/Role/Object.pm b/lib/WebGUI/Definition/Role/Object.pm index 8789f5a6a..010225142 100644 --- a/lib/WebGUI/Definition/Role/Object.pm +++ b/lib/WebGUI/Definition/Role/Object.pm @@ -66,7 +66,7 @@ sub get { } return undef; } - my %properties = map { $_ => scalar $self->$_ } $self->meta->get_property_list; + my %properties = map { $_ => scalar $self->$_ } $self->meta->get_all_attributes_list; return \%properties; }