classDescriptionForDestinationKey returning Object instead of the good class
classDescriptionForDestinationKey returning Object instead of the good class
- Subject: classDescriptionForDestinationKey returning Object instead of the good class
- From: Pascal Robert <email@hidden>
- Date: Fri, 20 May 2011 08:08:29 -0400
I'm playing with GitHub's Post-Receive Hooks (http://help.github.com/post-receive-hooks/) so that we can send commits messages to a mailing list and Twitter. So I added a GHPayload class, like this:
public class GHPayload {
private java.util.LinkedList<GHCommit> commits;
private String ref;
private String before;
private String after;
private GHRepository repository;
...
And GHCommit looks like this:
public class GHCommit {
private NSArray<String> added;
private NSArray<String> removed;
private NSArray<String> modified;
private GHContact author;
private NSTimestamp timestamp;
private String message;
private String url;
private String id;
Now, the problem is that the "commits" array is always empty in the response, even if I pass an array with two commits in them. I found out that the problem is because a commit have a "id" attribute, so ERRest try to find an object with this id. So I removed "id" from the request just to see how far it will go, and I'm getting those:
UnknownKeyException: <java.lang.Object 0x71fb68f> takeValueForKey(): attempt to assign value to unknown key: 'url'.
I do have a "url" attribute in GHCommit, so with some debugging, I found that the entity name was Object instead of GHCommit:
<class er.rest.BeanInfoClassDescription (entity name: Object, attributes: (), to-one relationships: (), to-many relationships:())>
And this is caused by:
public class BeanInfoClassDescription
...
public EOClassDescription classDescriptionForDestinationKey(String detailKey) {
...
return ERXRestClassDescriptionFactory.classDescriptionForClass(Object.class, true);
}
What do I need to do in my class so that the descriptor returns a IndexedPropertyDescriptor instead of PropertyDescriptor? Both GHPayload and GHCommit have getters starting with "get" (I thought the problem was there, before I didn't have any "get" in from the getters name).
_______________________________________________
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