The [ClassAlias] annotation can be specified for a user defined class.
System Attribute
IBM.WebSphere.Caching.Map ClassAliasAttribute
Namespace: IBM.WebSphere.Caching.Map
Assembly: Client.Api (in Client.Api.dll) Version: 8.6.0.0
The syntax for the class could look like :
[ClassAlias("ACME_Employee")]
In the above example, ACME_Employee is the class alias for this user defined class.
If [ClassAlias] annotation is not defined, the name of this class is set as the ClassAlias.
[ClassAlias("ACME_Employee")] class Employee1 { [FieldAlias("Employee ID")] int empId = -1; [FieldAlias("Department No.")] int deptId = -1; [FieldAlias("Year Salary")] float salary = 0; [FieldAlias("SEX")] String sex = "M"; int age = -1; String homeAddress = "";
When a ClassAlias and/or FieldAlias are specified in a user defined class, the ClassAlias and/or FieldAlias will be used to create or correlate with an object that are stored or will be stored in the grid. If two user defined classes (in a separate .NET application environment) have the different class name, but they were marked as the same ClassAlias, and all fields and field types are matched between these 2 classes, they will be correlated with the same class type ID even though they have the different class name. This way will allow the same class metadata to be reused between these 2 classes when running serialization and de-serialization in the different .NET application runtime, as well as to shared with Java when the Alias for the class defined in Java and fields are also matched.