Subclasses

Subclassing is completely optional, however it has many advantages, including terseness, extensibility, and support for autocomplete. In Symbyoz you can automatically generate subclasses of your Modules, in Swift and Java , from the Configuration section of your backend.

It will literally transforms this code:

ParseObject object = new ParseObject("ClassName");
object.put("displayName", "John Doe");
object.put("isFunny", false);
object.put("age", 50);

Into this:

ClassName object = new ClassName();
object.setDisplayName("John Doe");
object.setIsFunny(false);
object.setAge(50);

Creating Subclass

Follow this example to have your own subclass ready to use.

  1. Create your class as following

ClassName.java
import com.parse.ParseClassName;
import com.parse.ParseObject;

@ParseClassName("ClassName")
public class ClassName extends ParseObject
{
  public String getDisplayName() 
  {
    return getString("displayName");
  }
  
  public void setDisplayName(String value) 
  {
    put("displayName", value);
  }
}

2. Register your class before you initialize Parse in your Application class

And you're all done!

Now you can simply use it as you would use any other Object but with a structured model and accessor added.

Last updated

Was this helpful?