NAME
PerlBean::Attribute::Factory - factory package to generate PerlBean::Attribute objects
SYNOPSIS
use strict;
use PerlBean::Attribute::Factory;
my $factory = PerlBean::Attribute::Factory->new ();
my $attr = $factory->createAttribute ({
type => 'BOOLEAN',
attribute_name => 'true',
short_description => 'something is true',
});
use IO::File;
-d 'tmp' || mkdir ('tmp');
my $fh = IO::File->new ('> tmp/PerlBean_Attribute_Factory.pl.out');
$attr->writeMethods ($fh);
$attr->writeDocMethods ($fh);
ABSTRACT
PerlBean::Attribute object factory
DESCRIPTION
PerlBean::Attribute::Factory objects create instances of PerlBean::Attribute objects.
CONSTRUCTOR
METHODS
- createAttribute (OPT_HASH_REF)
-
Returns
PerlBean::Attributeobjects based onOPT_HASH_REF.OPT_HASH_REFis a hash reference used to pass initialization options. The selected subclass ofPerlBean::Attributeis initialized usingOPT_HASH_REF. On error an exceptionError::Simpleis thrown.Options for
OPT_HASH_REFused by this method may include:- associative
-
Boolean flag. States that the returned attribute must be unique, associative
MULTI. Defaults to 0. Only makes sense iftypeis MULTI and unique is true. - method_key
-
Boolean flag. States that the returned attribute must be unique, associative
MULTI. Defaults to 0. Only makes sense iftypeis MULTI and unique is true. - ordered
-
Boolean flag. States that the returned attribute must be an ordered list. Defaults to 0. Only makes sense if
typeis MULTI. - type
-
If
typeis BOOLEAN aPerlBean::Attribute::Boolean, on SINGLE aPerlBean::Attribute::Singleand on MULTI aPerlBean::Attribute::Multiis returned. Defaults to SINGLE. NOTE: type has precedence over ordered and unique. - unique
-
Boolean flag. States that the items in the
MULTIattribute must be unique. Defaults to 0. Only makes sense iftypeis MULTI.
Options for
OPT_HASH_REFpassed to packagePerlBean::Attributemay include:attribute_name-
Passed to "setAttributeName ()". Mandatory option.
default_value-
Passed to "setDefaultValue ()".
exception_class-
Passed to "setExceptionClass ()". Defaults to Error::Simple.
mandatory-
Passed to "setMandatory ()". Defaults to 0.
method_base-
Passed to "setMethodBase ()".
perl_bean-
Passed to "setPerlBean ()".
short_description-
Passed to "setShortDescription ()".
Options for
OPT_HASH_REFpassed to packagePerlBean::Attribute::Singlemay include:allow_empty-
Passed to "setAllowEmpty ()". Defaults to 1.
allow_isa-
Passed to "setAllowIsa ()". Must be an
ARRAYreference. allow_ref-
Passed to "setAllowRef ()". Must be an
ARRAYreference. allow_rx-
Passed to "setAllowRx ()". Must be an
ARRAYreference. allow_value-
Passed to "setAllowValue ()". Must be an
ARRAYreference.
SEE ALSO
PerlBean, PerlBean::Attribute, PerlBean::Attribute::Boolean, PerlBean::Attribute::Multi, PerlBean::Attribute::Multi::Ordered, PerlBean::Attribute::Multi::Unique, PerlBean::Attribute::Multi::Unique::Associative, PerlBean::Attribute::Multi::Unique::Associative::MethodKey, PerlBean::Attribute::Multi::Unique::Ordered, PerlBean::Attribute::Single, PerlBean::Collection, PerlBean::Method
BUGS
None known (yet.)
HISTORY
First development: November 2002
AUTHOR
Vincenzo Zocca
COPYRIGHT
Copyright 2002, 2003 by Vincenzo Zocca
LICENSE
This file is part of the PerlBean module hierarchy for Perl by Vincenzo Zocca.
The PerlBean module hierarchy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The PerlBean module hierarchy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the PerlBean module hierarchy; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA