java - adding a variable to a class that maps to data table

Hi all,

Regarding java(android) data table mapping to client class, is there way I can add a variable to a data mapping class which doesn’t map to data table field?

I just have table field of type String which contains json, and want to add a variable of type JSONArray within the class.
I am not sure how mapping works, and I can’t think of other way then having unmapped variable declared in other class. Any suggestions? Can I use inner class to declare?

Thanks.

Hi Scott,

Try declaring that field as “transient”.

Regards,
Mark

Hi Mark,

Is it okay to have public method that returns value within a data mapped class? (that is not getter/setter for data field mapping)
As I searched, transient is only for variables.

Regards,
Scott

Hi Scott,

You’re right, I spoke too soon. Here’s what you can do: Add the following annotation to your class:

@ExcludeProperty( propertyName = "foo" )

The annotation is in the weborb.service namespace. Your code would look like this:

import weborb.service.ExcludeProperty;


@ExcludeProperty( propertyName = "foo" )
public class FooContainer
{
  private Foo _foo;
  public void setFoo( Foo _foo ){this._foo = _foo;}
  public Foo getFoo() { return _foo;}
}

Hope this helps.

Regards,
Mark