The [FieldAlias] annotation can be specified for user defined class fields.
System Attribute
IBM.WebSphere.Caching.Map FieldAliasAttribute
Namespace: IBM.WebSphere.Caching.Map
Assembly: Client.Api (in Client.Api.dll) Version: 8.6.0.0
The syntax for the field alias could look as follows :
[FieldAlias("Employee ID")]
In the above example, "Employee ID" is a field alias for the empId field in this user defined class.
If [FieldAlias] annotation is not defined, the name of this field is set as the FieldAlias.
[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.