Setting PlainVariable value: IllegalArgumentException
Posted: 04 Jun 2015, 10:52
Hi everyone,
I'm experiencing problems when setting the value of a PlainVariable<OwnClass>. Can't a PlainVariable handle any type of content?
The trace tells me com.prosysopc.ua.server.nodes.PlainVariable.setCurrentValue throws an IllegalArgumentException because "Variant cannot be MyOwnTestClass". I actually chose PlainVariable in order to store custom objects. Is there a way to do this?
On a related note, why does a PlainVariable<String> still have its DataType set to BaseDataType? It only becomes String if I manually setDataTypeId(Identifiers.String). What exactly does the Type in PlainVariable<Type> type anyway?
I'm experiencing problems when setting the value of a PlainVariable<OwnClass>. Can't a PlainVariable handle any type of content?
Code: Select all
PlainVariable<MyOwnTestClass> myVariable = new PlainVariable<MyOwnTestClass> (nodeManager, myVarId, "my variable", Locale.ENGLISH);
myVariable.setCurrentValue(new MyOwnTestClass());
On a related note, why does a PlainVariable<String> still have its DataType set to BaseDataType? It only becomes String if I manually setDataTypeId(Identifiers.String). What exactly does the Type in PlainVariable<Type> type anyway?