NAME

ElasticSearchX::Model::Generator::AttributeGenerator - Generator that emits 'has' declarations for type properties.

VERSION

version 0.1.8

METHODS

fill_property_template

$string = $object->fill_property_template( $property_name, $property_value )

my $data = $object->fill_property_template( foo => 'bar' );
# $data == "    foo                         => bar,\n"
my $data = $object->fill_property_template(quote( 'foo' ) => quote( 'bar' ));
# $data == "    \"foo\"                       => \"bar\",\n"

fill_attribute_template

$string = $object->fill_attribute_template( $attribute_name, $attribute_properties_definition )

my $data = $object->fill_attribute_template( foo => '    is => rw =>, ' );
# $data ==
# has "foo"              => (
#     is => rw =>,
# );

generate

$generated_attribute = $attributegenerator->generate(
  propertydata => ... Property definition from JSON ...
  propertyname => ... Property name from JSON ...
  index        => ... Name of current index ...
  typename     => ... Name of the type we're generating ...
);

$generated_attribute->isa(ESX:M:G:Generated::Attribute);

ATTRIBUTES

generator_base

rw, required, weak_ref

FUNCTIONS

expand_type

%attr = ( %attr, expand_type( $type ) );
%attr = ( %attr, expand_type( 'boolean' ) );

hash_to_proplist

$string = hash_to_proplist( %hash )

my $data = hash_to_proplist(
   is => rw =>,
   required => 1,
   foo => undef,
);
# $data = <<'EOF'
# "is" => "rw",
# "required" => "1",
# "foo" => undef,
# EOF

PRIVATE METHODS

_property_template_string

_attribute_template_string

_inflate_attribute

my $attr = $self->_inflate_attribute(
    prefix => $dump_comment,
    propertyname => "name of property",
    properties => \%cleaned_properties_for_has
    original_definition => \%original_args_to_generate
);

_cleanup_properties

%cleaned_has_props = $self->_cleanup_properties(%source_props)

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.