1package JMX::Jmx4Perl::Alias::Object; 2 3=head1 NAME 4 5JMX::Jmx4Perl::Alias::Object - Internal object representing a concrete alias 6 7=head1 DESCRIPTION 8 9Simple object which describes an alias. It knows about the following read-only 10methods 11 12=over 13 14=item $alias->alias() 15 16alias name in uppercase form (e.g. C<MEMORY_HEAP_USED>) 17 18=item $alias->name() 19 20alias name in lowercase format (e.g. C<memory:heap:used>) 21 22=item $alias->description() 23 24short description of the alias 25 26=item $alias->default() 27 28default values for an alias, which can be overwritten by a specific 29L<JMX::Jmx4Perl::Product::BaseHandler>. This is an arrayref with two values: 30The MBean's name and the attribute or operation name. 31 32=item $alias->type() 33 34Either C<attribute> or C<operation>, depending on what kind of MBean part the 35alias stands for. 36 37=back 38 39Additional, the C<"">, C<==> and C<!=> operators are overloaded to naturally 40compare and stringify alias values. 41 42=cut 43 44use Scalar::Util qw(refaddr); 45 46use overload 47 q{""} => sub { (shift)->as_string(@_) }, 48 q{==} => sub { (shift)->equals(@_) }, 49 q{!=} => sub { !(shift)->equals(@_) }; 50 51sub equals { 52 return (ref $_[0] eq ref $_[1] && refaddr $_[0] == refaddr $_[1]) ? 1 : 0; 53} 54 55sub new { 56 my $class = shift; 57 return bless { @_ },ref($class) || $class; 58} 59 60sub as_string { return $_[0]->{alias}; } 61sub alias { return shift->{alias}; } 62sub name { return shift->{name}; } 63sub description { return shift->{description}; } 64sub default { return shift->{default}; } 65sub type { return shift->{type}; } 66 67=head1 LICENSE 68 69This file is part of jmx4perl. 70 71Jmx4perl is free software: you can redistribute it and/or modify 72it under the terms of the GNU General Public License as published by 73the Free Software Foundation, either version 2 of the License, or 74(at your option) any later version. 75 76jmx4perl is distributed in the hope that it will be useful, 77but WITHOUT ANY WARRANTY; without even the implied warranty of 78MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 79GNU General Public License for more details. 80 81You should have received a copy of the GNU General Public License 82along with jmx4perl. If not, see <http://www.gnu.org/licenses/>. 83 84A commercial license is available as well. Please contact roland@cpan.org for 85further details. 86 87=head1 PROFESSIONAL SERVICES 88 89Just in case you need professional support for this module (or Nagios or JMX in 90general), you might want to have a look at 91http://www.consol.com/opensource/nagios/. Contact roland.huss@consol.de for 92further information (or use the contact form at http://www.consol.com/contact/) 93 94=head1 AUTHOR 95 96roland@cpan.org 97 98=cut 99 1001; 101