Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide factoryMethod in ObjectBuilder #2

Open
trung opened this issue Apr 27, 2011 · 0 comments
Open

Provide factoryMethod in ObjectBuilder #2

trung opened this issue Apr 27, 2011 · 0 comments

Comments

@trung
Copy link

trung commented Apr 27, 2011

It'd be handy that ObjectBuilder can generate object based on the given factoryMethod. It's used for singleton.

For example,

package {
   public class MySingletonClass {
       private var _singleton:MySingletonClass = null;
       public MySingletonClass() {
            new SingletonEnforcer();
       }
       public static function instance():MySingletonClass {
            if (_singleton == null) {
                 _singleton = new MySingletonClass();
            }
            return _singleton;
       }
   }
}
class SingletonEnforcer {}
<ObjectBuilder generator="{MySingletonClass}" factoryMethod="instance" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant