We are in code freeze… As part of the release process I’m gathering the changes we implemented over the past few months. Quite a few didn’t get a blog post during this time. So here is a list of the important things we didn’t document.
We did two big things for ParparVM (our iOS VM) which allowed us to expose this functionality in other platforms as well. First is support for most of the small methods in Class which can be helpful when we write some generic code. Specifically the methods: isEnum(), isSynthetic(), isInterface(), isAnonymousClass(), isPrimitive() and isAnnotation().
We can’t guarantee that these will work perfectly for all cases as there are some complexities. E.g. our process for supporting Java 8 might trigger true for isAnonymousClass() due to a lambda. But this is a start.
Objects includes some common useful utility methods. Hopefully we’ll add a few more classes like that as needed.
We supported JSON in properties from day one. XML is a bit harded but not by much. We added highly experimental support for XML into properties which can be useful when working with XML data from the server or storage.
This feature is experimental and the API might change/break
PropertyIndex includes several new API’s to enable that. First we have:
public Element asElement();
This returns the PropertyBusinessObject as an XML Element object which is the parsed form of XML in Codename One. You can use XMLWriter to convert this to a String or use XML processing code to work with the Element.
The toXML() method in PropertyIndex takes the next step of converting that XML Element to a String and returning it:
public String toXML();
A property in the object can appear as the text element e.g. <tag>Text Element</tag>. You can explicitly define which by using these methods in PropertyIndex:
public void setXmlTextElement(PropertyBase p, boolean t);
public boolean isXmlTextElement(PropertyBase p);
Finally, we can parse XML by using:
public void fromXml(Element e);
This will walk the parsed XML and convert it to the object we’re using.
We now have a new full screen API. The following code assumes you have an import of CN specifically import static com.codename1.ui.CN.*;:
Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems. For more follow Shai on Twitter & github.