Hi All
Ours is a Flex/Parsley/Blazeds/Spring project & I'm trying to implement java Enums in Actionscript3 and all I have to do is to send the Enum value to Spring service method.
The Java Enum Code (this is generated from XSD)
public enum ReferenceLookupType {
PATIENT_VISIT_TYPE("PATIENT_VISIT_TYPE"), PATIENT_STATUS(
"PATIENT_STATUS"), PATIENT_VISIT_INVALID_REASON(
"PATIENT_VISIT_INVALID_REASON"), LIPID_PREFILLED_CODE(
"LIPID_PREFILLED_CODE");
private final String value;
private ReferenceLookupType(String value) {
this.value = value;
}
public String toString() {
return value;
}
public static ReferenceLookupType convert(String value) {
for (ReferenceLookupType inst : values()) {
if (inst.toString().equals(value)) {
return inst;
}
}
return null;
}
}
The Actionscript Enum is:
package {
[Bindable]
[RemoteClass(alias="gov.hhs.cms.ehrds.datacollection.model.ReferenceLookupType")]
public final class ReferenceLookupType {
public static const PATIENT_VISIT_TYPE:ReferenceLookupType = new ReferenceLookupType("PATIENT_VISIT_TYPE");
public static const PATIENT_STATUS:ReferenceLookupType = new ReferenceLookupType("PATIENT_STATUS");
public static const PATIENT_VISIT_INVALID_REASON:ReferenceLookupType = new ReferenceLookupType("PATIENT_VISIT_INVALID_REASON");
public static const LIPID_PREFILLED_CODE:ReferenceLookupType = new ReferenceLookupType("LIPID_PREFILLED_CODE");
private var _value:String;
public function ReferenceLookupType(value:String) : void
{
_value = value;
}
public function toString():String
{
return _value;
}
}
}
In the mxml code:
[Bindable]
private var refLookupType:ReferenceLookupType = ReferenceLookupType.LIPID_PREFILLED_CODE;
dispatcher(new ReferenceDataMessage(refLookupType, "RefData"));
The Error I'm getting is:
"Unable to create a new instance of type 'gov.hhs.cms.ehrds.datacollection.model.ReferenceLookupType'." faultCode="Client.Message.Encoding" faultDetail="Types cannot be instantiated without a public, no arguments constructor."
[RPC Fault faultString="Unable to create a new instance of type 'gov.hhs.cms.ehrds.datacollection.model.ReferenceLookupType'." faultCode="Client.Message.Encoding" faultDetail="Types cannot be instantiated without a public, no arguments constructor."]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:345]
at mx.rpc::Responder/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:68]
at mx.rpc::AsyncRequest/fault()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113]
at NetConnectionMessageResponder/statusHandler()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:609]
at mx.messaging::MessageResponder/status()[E:\dev\4.0.0\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:264]
Can you please help in what I'm missing here and on how to implement Enums in Actionscript the right way.
Thanks
Harish