Ferreteria/v0.6/sys/Registry/class: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
(Created page with "{{fmt/title|about <u>class</u> registries|see also: {{l/same|object}} registries}} ==About== * '''Purpose''': You have a set of classes (clade-family) for handling a situation, and you need to look up the class to use. Often this is a Singleton object which can then be accessed from a static method in the class (typically <code>{{l/ver/fx|Me}}()</code>). ===use-cases=== As of 2025-10-15: I'm not sure if this concept is currently in use. There's a variant, {{l/ver/clade|C...")
 
No edit summary
Line 1: Line 1:
{{fmt/title|about <u>class</u> registries|see also: {{l/same|object}} registries}}
{{fmt/title|about <u>class</u> registries|see also: {{l/same|object}} registries}}
==About==
==About==
* '''Purpose''': You have a set of classes (clade-family) for handling a situation, and you need to look up the class to use. Often this is a Singleton object which can then be accessed from a static method in the class (typically <code>{{l/ver/fx|Me}}()</code>).
* '''Purpose''': You have a set of classes (clade-family) for handling a situation, and you need to look up the class to use and/or retrieve an object of that class.
===use-cases===
===use-cases===
As of 2025-10-15: I'm not sure if this concept is currently in use. There's a variant, {{l/ver/clade|Config|Classes}}, where the context is invoked through a function. I'm not sure if this is in use either, though that at least is easier to check ({{hashtag|TODO}}).
This is used to register Database Engine classes to be available. The <code>{{l/ver/clade/full|p=ferreteria|Config\Roster\for|AClass}}</code> trait provides <code>{{l/ver/fx|RegisterSelf}}()</code> for classes to self-register (<code>{{fmt/arg|class-name}}::RegisterSelf()</code>) and <code>{{l/ver/fx|FromClassSlug}}(string $sSlug)</code> to retrieve an object for that class from a slug-string.
==Clades==
==Clades==
* {{l/ver/clade/full|p=ferreteria|Config|Classes}}
* {{l/ver/clade/full|p=ferreteria|Config|Classes}}
* {{l/ver/clade/full|p=ferreteria|Config\Roster|Classes}}
* {{l/ver/clade/full|p=ferreteria|Config\Roster|Classes}}
* {{l/ver/clade/full|p=ferreteria|Config\Roster\for|AClass}}

Revision as of 14:19, 21 October 2025

about class registries
see also: object registries

About

  • Purpose: You have a set of classes (clade-family) for handling a situation, and you need to look up the class to use and/or retrieve an object of that class.

use-cases

This is used to register Database Engine classes to be available. The Config\Roster\for\AClass trait provides RegisterSelf() for classes to self-register (<class-name>::RegisterSelf()) and FromClassSlug(string $sSlug) to retrieve an object for that class from a slug-string.

Clades