IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.config
Class QueryMapping

java.lang.Object
  extended by com.ibm.websphere.objectgrid.config.QueryMapping
All Implemented Interfaces:
Serializable

public class QueryMapping
extends Object
implements Serializable

A QueryMapping maps a Java class to a BackingMap and allows a map to be included in a query. It also indicates whether the query engine should use a getter method or direct field access to access fields in the value class.

For example, class Department is the value class that is stored in the "DepartmentMap" BackingMap and the key is an Integer.

 public class Department {
     private int id;
     private Collection emps;
     
     public void setEmps(Collection emps) {
         this.emps = emps;
     }
     
     public Collection getEmps() {
         return emps;
     }
     ...
 }
 
The QueryMapping would be created as follows:
 ...
 QueryConfig queryConfig = new QueryConfig();
 queryConfig.addMapping(new QueryMapping(
     "DepartmentMap", Department.class.getName(), "id", QueryMapping.PROPERTY_ACCESS)
 objectGrid.setQueryConfig(queryConfig);
 ...
 

Since:
WAS XD 6.1, XC10
See Also:
Serialized Form

Field Summary
static int FIELD_ACCESS
          This constant indicates to use direct field access to read the field values
static int PROPERTY_ACCESS
          This constant indicates to use JavaBean property-style get methods to read the field values from the Java object stored in the BackingMap.
 
Constructor Summary
QueryMapping()
          Default constructor.
QueryMapping(String mapName, String valueClass, String primaryKeyField)
          Constructor for creating a basic QueryMapping instance with a default access type of PROPERTY_ACCESS.
QueryMapping(String mapName, String valueClass, String primaryKeyField, int accessType)
          Constructor for creating a QueryMapping instance.
 
Method Summary
 boolean equals(Object o)
           
 int getAccessType()
          Retrieve the method in which the query engine will access the value class object stored in the BackingMap.
 String getMapName()
          Retrieve the BackingMap name associated with this mapping.
 String getPrimaryKeyField()
          Retrieve the name of the attribute in the value class object that is also the primary key of the BackingMap.
 String getValueClass()
          Retrieve the type of object that is stored in the BackingMap.
 int hashCode()
           
 void setAccessType(int accessType)
          Set the method in which the query engine will access the value class object stored in the BackingMap.
 void setMapName(String mapName)
          Set the BackingMap name associated with this mapping.
 void setPrimaryKeyField(String primaryKeyField)
          Set the name of the attribute in the value class object that is also the primary key of the BackingMap.
 void setValueClass(String valueClass)
          Set the type of object that is stored in the BackingMap.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_ACCESS

public static final int FIELD_ACCESS
This constant indicates to use direct field access to read the field values

See Also:
setAccessType(int), getAccessType(), Constant Field Values

PROPERTY_ACCESS

public static final int PROPERTY_ACCESS
This constant indicates to use JavaBean property-style get methods to read the field values from the Java object stored in the BackingMap. PROPERTY_ACCESS is the default.

See Also:
setAccessType(int), getAccessType(), Constant Field Values
Constructor Detail

QueryMapping

public QueryMapping()
Default constructor.


QueryMapping

public QueryMapping(String mapName,
                    String valueClass,
                    String primaryKeyField)
Constructor for creating a basic QueryMapping instance with a default access type of PROPERTY_ACCESS.

The mapName and valueClass must not be null.

Parameters:
mapName - the name of the BackingMap to map
valueClass - the class of object stored in the BackingMap's value.
primaryKeyField - the optional name of the primary key field of the class.

QueryMapping

public QueryMapping(String mapName,
                    String valueClass,
                    String primaryKeyField,
                    int accessType)
Constructor for creating a QueryMapping instance. The mapName and valueClass must not be null.

Parameters:
mapName - the name of the BackingMap to map
valueClass - the class of object stored in the BackingMap's value.
primaryKeyField - the optional name of the primary key field of the class.
accessType - the method (PROPERTY_ACCESS or FIELD_ACCESS) in which the query engine will access the persistent data in the value object.
Method Detail

getMapName

public String getMapName()
Retrieve the BackingMap name associated with this mapping.

Returns:
the BackingMap name.

setMapName

public void setMapName(String mapName)
Set the BackingMap name associated with this mapping.


getValueClass

public String getValueClass()
Retrieve the type of object that is stored in the BackingMap.

Returns:
the object type that is stored in the BackingMap's value.

setValueClass

public void setValueClass(String valueClass)
Set the type of object that is stored in the BackingMap.


getAccessType

public int getAccessType()
Retrieve the method in which the query engine will access the value class object stored in the BackingMap.

Returns:
Returns the accessType.
See Also:
PROPERTY_ACCESS, FIELD_ACCESS

setAccessType

public void setAccessType(int accessType)
Set the method in which the query engine will access the value class object stored in the BackingMap.

Parameters:
accessType - the accessType.
See Also:
PROPERTY_ACCESS, FIELD_ACCESS

getPrimaryKeyField

public String getPrimaryKeyField()
Retrieve the name of the attribute in the value class object that is also the primary key of the BackingMap.

This value is optional.

Returns:
the primaryKeyField.

setPrimaryKeyField

public void setPrimaryKeyField(String primaryKeyField)
Set the name of the attribute in the value class object that is also the primary key of the BackingMap.

Parameters:
primaryKeyField - the name of the primary key attribute or null if not set.

equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.