One of the most valuable aliases usecases is working with persistent Java classes from a .NET application and vice versa. You can use both TypeAlias and WildcardAlias depending on how many classes you need to access.
For example, Pilot objects are saved to a database from a Java application:
01public static void saveObjects(){ 02
new File(YAPFILENAME ).delete(); 03
ObjectContainer db = Db4o.openFile(YAPFILENAME); 04
try { 05
Pilot pilot = new Pilot("David Barrichello",99); 06
db.set(pilot); 07
pilot = new Pilot("Michael Schumacher",100); 08
db.set(pilot); 09
} finally { 10
db.close(); 11
} 12
}
In order to read the saved objects successfully from a .NET application we will need to define an alias, containing namespace and assembly information:
Now the objects are accessible from the .NET application:One thing to remember: field names in class definitions in Java and .NET should be exactly the same.