Custom type EOModeler issue
Custom type EOModeler issue
- Subject: Custom type EOModeler issue
- From: Wolfram Stebel <email@hidden>
- Date: Tue, 27 Dec 2005 22:27:49 +0100
- Thread-topic: Custom type EOModeler issue
Hi list,
Nice christmas? Hopefully.
As a training session i created a custom data type " MyType":
I created my own class MyType with the recommended methods (see below).
In EOModeler i map MyType to:
External type: varchar
Type: Custom
Width: 3
class: MyType
factory method: valueOf: (see below!)
conversion method: toString ( see below!)
Init Arguments: NSString
Getting values from the DB works like a charme.
Save.Changes leads to:
java.lang.IllegalArgumentException: While trying to invoke the set method
"public void CSampleTable.setAvalue(MyType)" on an object of type
CSampleTable we received an argument of type java.lang.String. This often
happens if you forget to use a formatter.
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.throwMethodExcepti
onWithDescription(NSKeyValueCoding.java:1155)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.setValueInObject(N
SKeyValueCoding.java:1177)
at
com.webobjects.eocontrol.EOCustomObject.takeValueForKey(EOCustomObject.java:
1601)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.takeValueForKey(NSKeyValu
eCoding.java:519)
at
com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeVal
ueForKeyPath(NSValidation.java:733)
at
com.webobjects.eocontrol.EOCustomObject.validateTakeValueForKeyPath(EOCustom
Object.java:1363)
at
com.webobjects.foundation.NSValidation$Utility.validateTakeValueForKeyPath(N
SValidation.java:551)
at
com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeVal
ueForKeyPath(NSValidation.java:741)
at
com.webobjects.appserver.WOComponent.validateTakeValueForKeyPath(WOComponent
.java:1273)
at
com.webobjects.appserver._private.WOKeyValueAssociation.setValue(WOKeyValueA
ssociation.java:71)
at
com.webobjects.appserver._private.WOTextField.takeValuesFromRequest(WOTextFi
eld.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromReque
st(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODyn
amicGroup.java:89)
at
com.webobjects.appserver._private.WORepetition.takeValuesFromRequest(WORepet
ition.java:124)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromReque
st(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODyn
amicGroup.java:89)
at
com.webobjects.appserver._private.WOForm.takeValuesFromRequest(WOForm.java:7
0)
at
com.webobjects.appserver._private.WOComponentContent.takeValuesFromRequest(W
OComponentContent.java:20)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromReque
st(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODyn
amicGroup.java:89)
at
com.webobjects.appserver.WOComponent.takeValuesFromRequest(WOComponent.java:
914)
at
com.webobjects.appserver._private.WOComponentReference.takeValuesFromRequest
(WOComponentReference.java:97)
at
com.webobjects.appserver._private.WODynamicGroup.takeChildrenValuesFromReque
st(WODynamicGroup.java:81)
at
com.webobjects.appserver._private.WODynamicGroup.takeValuesFromRequest(WODyn
amicGroup.java:89)
at
com.webobjects.appserver.WOComponent.takeValuesFromRequest(WOComponent.java:
914)
at
com.webobjects.appserver.WOSession.takeValuesFromRequest(WOSession.java:1139
)
at
com.webobjects.appserver.WOApplication.takeValuesFromRequest(WOApplication.j
ava:1350)
...
----------
I tried to follow "Practical WebObjects" but without success!
What am i missing?
It seems to me, that one or more additional methods are required, to convert
objects correctly for this purpose.
In comparison: i have the sample Boolean class of Practical WO, it works!
TIA
Wolfram
------------
public class MyType {
private String value;
public MyType ( String v )
{
this.setValue ( v );
}
public void setValue ( String v )
{
value = v;
}
public String getValue ()
{
return value;
}
public static MyType valueOf ( String v )
{
return new MyType ( v );
}
public String toString ()
{
return value;
}
public Object clone () throws CloneNotSupportedException
{
return ( ( MyType ) super.clone () );
}
public boolean equals ( Object obj )
{
return ( ( ( MyType ) obj ).getValue ().equals ( this.getValue() )
);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden