Vincenzo Zocca > PerlBean-1.0 > PerlBean::Attribute::Factory

Download:
PerlBean-1.0.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.0   Source  

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->create_attribute( {
     type => 'BOOLEAN',
     method_factory_name => 'true',
     short_description => 'something is true',
 } );

ABSTRACT ^

PerlBean::Attribute object factory

DESCRIPTION ^

PerlBean::Attribute::Factory objects create instances of PerlBean::Attribute objects.

CONSTRUCTOR ^

new()

Creates a new PerlBean::Attribute::Factory object.

METHODS ^

create_attribute(OPT_HASH_REF)

Returns PerlBean::Attribute objects based on OPT_HASH_REF. OPT_HASH_REF is a hash reference used to pass initialization options. The selected subclass of PerlBean::Attribute is initialized using OPT_HASH_REF. On error an exception Error::Simple is thrown.

Options for OPT_HASH_REF used by this method may include:

associative

Boolean flag. States that the returned attribute must be unique, associative MULTI. Defaults to 0. Only makes sense if type is 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 if type is 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 type is MULTI.

type

If type is BOOLEAN a PerlBean::Attribute::Boolean, on SINGLE a PerlBean::Attribute::Single and on MULTI a PerlBean::Attribute::Multi is returned. Defaults to 'SINGLE'. NOTE: type has precedence over ordered and unique.

unique

Boolean flag. States that the items in the MULTI attribute must be unique. Defaults to 0. Only makes sense if type is MULTI.

Options for OPT_HASH_REF passed to package PerlBean::Attribute may include:

default_value

Passed to set_default_value().

exception_class

Passed to set_exception_class(). Defaults to 'Error::Simple'.

mandatory

Passed to set_mandatory(). Defaults to 0.

method_base

Passed to set_method_base().

method_factory_name

Passed to set_method_factory_name(). Mandatory option.

perl_bean

Passed to set_perl_bean().

short_description

Passed to set_short_description().

Options for OPT_HASH_REF passed to package PerlBean::Attribute::Single may include:

allow_empty

Passed to set_allow_empty(). Defaults to 1.

allow_isa

Passed to set_allow_isa(). Must be an ARRAY reference.

allow_ref

Passed to set_allow_ref(). Must be an ARRAY reference.

allow_rx

Passed to set_allow_rx(). Must be an ARRAY reference.

allow_value

Passed to set_allow_value(). Must be an ARRAY reference.

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::Dependency, PerlBean::Dependency::Import, PerlBean::Dependency::Require, PerlBean::Dependency::Use, PerlBean::Described, PerlBean::Described::ExportTag, PerlBean::Method, PerlBean::Method::Constructor, PerlBean::Method::Factory, PerlBean::Style, PerlBean::Symbol

BUGS ^

None known (yet.)

HISTORY ^

First development: November 2002 Last update: September 2003

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

syntax highlighting: