public interface TypeConverter
Converts Qilletni to Java types and back.
-
Method Summary
Modifier and TypeMethodDescription<T> TconvertFromEntityToRecord(EntityType entity, Class<T> clazz) Takes a Qilletni entity and converts it to a Java record.convertFromRecordToEntity(String entityName, Object object) Takes a Java record and converts it to a Qilletni entity.<T> TconvertToJavaType(QilletniType qilletniType, Class<T> clazz) Convert a Java object to a QilletniType object.convertToQilletniType(Object object) Convert a QilletniType object to a Java object.convertToQilletniTypes(List<Object> objects) Converts a list of Java objects to a list of QilletniType objects.
-
Method Details
-
convertToJavaType
Convert a Java object to a QilletniType object.- Type Parameters:
T- The new type of the object- Parameters:
qilletniType- The object to convertclazz- The class of the object to convert to- Returns:
- The converted object
-
convertToQilletniType
Convert a QilletniType object to a Java object. If it's already a QilletniType object, it will be returned as is.- Parameters:
object- The object to convert- Returns:
- The converted object
-
convertToQilletniTypes
Converts a list of Java objects to a list of QilletniType objects. Useful for parameter conversions.- Parameters:
objects- The list of objects to convert- Returns:
- The converted QilletniType objects
-
convertFromRecordToEntity
Takes a Java record and converts it to a Qilletni entity. The entity's constructor must be in the same order as the record's fields.- Parameters:
entityName- The name of the entity to createobject- The Java record- Returns:
- The created Qilletni entity
-
convertFromEntityToRecord
Takes a Qilletni entity and converts it to a Java record. The record's field names must be the same as the entity's properties. A Java record may have a Qilletni private field mapped without the prefixing underscore, however it should be noted that entities with two properties of the same name but with and without the underscore (e.g. x and _x) it will not work well.- Type Parameters:
T- The type of the record- Parameters:
entity- The Qilletni entity to convertclazz- The class of the record to create- Returns:
- The created Java record
-