You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
Is it possible to instantiate a class by constructor params, and how?
like:
public class TestClass {
private var _test:String;
private var _innerTestClass:InnerTestClass;
public function TestClass(test:String, innerTestClass:InnerTestClass) {
_test = test;
_innerTestClass = innerTestClass;
}
public function get test():String {
return _test;
}
public function get innerTestClass():InnerTestClass {
return _innerTestClass;
}
}
public class InnerTestClass {
private var _innerString:String;
public function InnerTestClass(innerString:String) {
this._innerString = innerString;
}
public function get innerString():String {
return _innerString;
}
}
The text was updated successfully, but these errors were encountered:
There is not currently any method to invoke parametrized constructors.
If you're using this for serialization, I would advise to create a separate class as a transfer object. It both eases the de/serialization process and makes the resulting JSON/XML/etc simpler.
Alternately you could use namespaces (see: http://gskinner.com/blog/archives/2010/01/a_complete_guid.html) to hide the setters in your classes and I think the serializer and deserializer respect them. I know I did that one one project but I don't recall whether or not I had to write code in addition to what's in this library to make it work.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is it possible to instantiate a class by constructor params, and how?
like:
public class TestClass {
}
public class InnerTestClass {
private var _innerString:String;
}
The text was updated successfully, but these errors were encountered: