.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "UR::Object::Property 3pm" .TH UR::Object::Property 3pm "2019-01-02" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" UR::Object::Property \- Class representing metadata about a class property .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& my $prop = UR::Object::Property\->get(class_name => \*(AqSome::Class\*(Aq, property_name => \*(Aqfoo\*(Aq); \& \& my $class_meta = Some::Class\->_\|_meta_\|_; \& my $prop2 = $class_meta\->property_meta_for_name(\*(Aqfoo\*(Aq); \& \& # Print out the meta\-property name and its value of $prop2 \& print map { " $_ : ".$prop2\->$_ } \& qw(class_name property_name data_type default_value); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Instances of this class represent properties of classes. For every item mentioned in the 'has' or 'id_by' section of a class definition become Property objects. .SH "INHERITANCE" .IX Header "INHERITANCE" UR::Object::Property is a subclass of UR::Object .SH "PROPERTY TYPES" .IX Header "PROPERTY TYPES" For this class definition: class Some::Class { has => [ other_id => { is => 'Text' }, other => { is => 'Some::Other', id_by => 'foo_id' }, bar => { via => 'other', to => 'bar' }, foos => { is => 'Some::Foo', reverse_as => 'some', is_many => 1 }, uc_other_id => { calculate_from => 'other_id', calculate_perl => 'uc($other_id)' }, ], }; .PP Properties generally fall in to one of these categories: .IP "regular property" 4 .IX Item "regular property" A regular property of a class holds a single scalar. In this case, \&'other_id' is a regular property. .IP "object accessor" 4 .IX Item "object accessor" An object accessor property returns objects of some class. The properties of this class must link in some way with all the \s-1ID\s0 properties of the remote class (the 'is' declaration). 'other' is an object accessor property. This is how one-to-one relationships are implemented. .IP "via property" 4 .IX Item "via property" When a class has some object accessor property, and it is helpful for an object to assume the value of the remote class's properties, you can set up a 'via' property. In the example above, an object of this class gets the value of its 'bar' property via the 'other' object it's linked to, from that object's 'bar' property. .IP "reverse as or is many property" 4 .IX Item "reverse as or is many property" This is how one-to-many relationships are implemented. In this case, the Some::Foo class must have an object accessor property called 'some', and the 'foos' property will return a list of all the Some::Foo objects where their 'some' property would have returned that object. .IP "calculated property" 4 .IX Item "calculated property" A calculated property doesn't store its data directly in the object, but when its accessor is called, the calculation code is executed. .SH "PROPERTIES" .IX Header "PROPERTIES" Each property has a method of the same name .SS "Direct Properties" .IX Subsection "Direct Properties" .IP "class_name => Text" 4 .IX Item "class_name => Text" The name of the class this Property is attached to .IP "property_name => Text" 4 .IX Item "property_name => Text" The name of the property. The pair of class_name and property name are the \s-1ID\s0 properties of UR::Object::Property .IP "column_name => Text" 4 .IX Item "column_name => Text" If the class is backed by a database table, then the column this property's data comes from is stored here .IP "data_type => Text" 4 .IX Item "data_type => Text" The type of data stored in this property. Corresponds to the 'is' part of a class's property definition. .IP "data_length => Number" 4 .IX Item "data_length => Number" The maximum size of data stored in this property .IP "default_value" 4 .IX Item "default_value" For is_optional properties, the default value given when an object is created and this property is not assigned a value. .IP "valid_values => \s-1ARRAY\s0" 4 .IX Item "valid_values => ARRAY" A listref of enumerated values this property may be set to .IP "doc => Text" 4 .IX Item "doc => Text" A place for documentation about this property .IP "is_id => Boolean" 4 .IX Item "is_id => Boolean" Indicates whether this is an \s-1ID\s0 property of the class .IP "is_optional => Boolean" 4 .IX Item "is_optional => Boolean" Indicates whether this is property may have the value undef when the object is created .IP "is_transient => Boolean" 4 .IX Item "is_transient => Boolean" Indicates whether this is property is transient? .IP "is_constant => Boolean" 4 .IX Item "is_constant => Boolean" Indicates whether this property can be changed after the object is created. .IP "is_mutable => Boolean" 4 .IX Item "is_mutable => Boolean" Indicates this property can be changed via its accessor. Properties cannot be both constant and mutable .IP "is_volatile => Boolean" 4 .IX Item "is_volatile => Boolean" Indicates this property can be changed by a mechanism other than its normal accessor method. Signals are not emitted even when it does change via its normal accessor method. .IP "is_classwide => Boolean" 4 .IX Item "is_classwide => Boolean" Indicates this property's storage is shared among all instances of the class. When the value is changed for one instance, that change is effective for all instances. .IP "is_delegated => Boolean" 4 .IX Item "is_delegated => Boolean" Indicates that the value for this property is not stored in the object directly, but is delegated to another object or class. .IP "is_calculated => Boolean" 4 .IX Item "is_calculated => Boolean" Indicates that the value for this property is not a part of the object'd data directly, but is calculated in some way. .IP "is_transactional => Boolean" 4 .IX Item "is_transactional => Boolean" Indicates the changes to the value of this property is tracked by a Context's transaction and can be rolled back if necessary. .IP "is_abstract => Boolean" 4 .IX Item "is_abstract => Boolean" Indicates this property exists in a base class, but must be overridden in a derived class. .IP "is_concrete => Boolean" 4 .IX Item "is_concrete => Boolean" Antonym for is_abstract. Properties cannot be both is_abstract and is_concrete, .IP "is_final => Boolean" 4 .IX Item "is_final => Boolean" Indicates this property cannot be overridden in a derived class. .IP "is_deprecated => Boolean" 4 .IX Item "is_deprecated => Boolean" Indicates this property's use is deprecated. It has no effect in the use of the property in any way, but is useful in documentation. .IP "implied_by => Text" 4 .IX Item "implied_by => Text" If this property is created as a result of another property's existence, implied_by is the name of that other property. This can happen in the case where an object accessor property is defined .Sp .Vb 3 \& has => [ \& foo => { is => \*(AqSome::Other\*(Aq, id_by => \*(Aqfoo_id\*(Aq }, \& ], .Ve .Sp Here, the 'foo' property requires another property called 'foo_id', which is not explicitly declared. In this case, the Property named foo_id will have its implied_by set to 'foo'. .IP "id_by => \s-1ARRAY\s0" 4 .IX Item "id_by => ARRAY" In the case of an object accessor property, this is the list of properties in this class that link to the \s-1ID\s0 properties in the remote class. .IP "reverse_as => Text" 4 .IX Item "reverse_as => Text" Defines the linking property name in the remote class in the case of an is_many relationship .IP "via => Text" 4 .IX Item "via => Text" For a via-type property, indicates which object accessor to go through. .IP "to => Text" 4 .IX Item "to => Text" For a via-type property, indicates the property name in the remote class to get its value from. The default value is the same as property_name .IP "where => \s-1ARRAY\s0" 4 .IX Item "where => ARRAY" Supplies additional filters for indirect properties. For example: .Sp .Vb 2 \& foos => { is => \*(AqSome::Foo\*(Aq, reverse_as => \*(Aqsome\*(Aq, is_many => 1 }, \& blue_foos => { via => \*(Aqfoos\*(Aq, where => [ color => \*(Aqblue\*(Aq ] }, .Ve .Sp Would create a property 'blue_foos' which returns only the related Some::Foo objects that have 'blue' color. .IP "calculate_from => \s-1ARRAY\s0" 4 .IX Item "calculate_from => ARRAY" For calculated properties, this is a list of other property names the calculation is based on .IP "calculate_perl => Text" 4 .IX Item "calculate_perl => Text" For calculated properties, a string containing Perl code. Any properties mentioned in calculate_from will exist in the code's scope at run time as scalars of the same name. .IP "class_meta => UR::Object::Type" 4 .IX Item "class_meta => UR::Object::Type" Returns the class metaobject of the class this property belongs to .SH "METHODS" .IX Header "METHODS" .IP "via_property_meta" 4 .IX Item "via_property_meta" For via/to delegated properties, return the property meta in the same class this property delegates through .IP "to_property_meta" 4 .IX Item "to_property_meta" For via/to delegated properties, return the property meta on the foreign class that this property delegates to .SH "SEE ALSO" .IX Header "SEE ALSO" UR::Object::Type, UR::Object::Type::Initializer, UR::Object