-
-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Hi!
Currently, I can define include tags like this:
[Exclude(name = "propertyName", kind = "property")]
[Exclude(name = "methodName", kind = "method")]
I need something like this:
// exclude all properties from all super classes
// for example class A (this class) extends class B extends class C extends class Object
// then all properties of B, C, Object will be excluded
[Exclude(name = "**", kind = "property")]
// exclude all methods from all super classes
[Exclude(name = "**", kind = "method")]
Is this possible? I really need this feature to create builder classes for my UI components. Like this:
var button:ActionButton = ActionButton.Standard.Text("Hello").Icon(DesktopIcon_ABC).Selected;
class ActionButton
:
public static function get Standard():ActionButtonBuilder
{
return new ActionButtonBuilder();
}
class ActionButtonBuilder
extends ActionButton
:
public function Text(value:String):ActionButtonBuilder
{
this.text = value;
return this;
}
public function Icon(value:*):ActionButtonBuilder
{
this.icon = value;
return this;
}
public function get Selected():ActionButtonBuilder
{
this.selected = true;
return this;
}
This works just like the Builder Design Pattern in Java - without the need for the build()
method - because ActionButtonBuilder
is ActionButton
already.
Workaround 1: Use multiple [Exclude
tags. In this case I have to write 225 lines to do this, and I have to edit these line whenever I add/remove any property/method of any super class.
Workaround 2: Use a builder class that does not extends ActionButton. So I have to add a build()
method at the end of the chain:
var button:ActionButton = ActionButton.Standard.Text("Hello").Icon(DesktopIcon_ABC).Selected.build();
or shorter:
var button:ActionButton = ActionButton.Standard.Text("Hello").Icon(DesktopIcon_ABC).Selected.$;
But it's not perfect.
Please consider to support this!
Thank you!