/*
* Copyright 2008 GigaSpaces Technologies LTD. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. GIGASPACES WILL NOT
* BE LIABLE FOR ANY DAMAGE OR LOSS IN CONNECTION WITH THE SOFTWARE.
*/
package com.gigaspaces.examples.tutorials.queries.common;
import com.gigaspaces.annotation.pojo.SpaceClass;
import com.gigaspaces.annotation.pojo.SpaceProperty;
import com.gigaspaces.annotation.pojo.SpaceProperty.IndexType;
/**
* A POJO account object used for query, contains 4 attributes:
* firstName, lastName, amount and riskAllowed. <p>
*
* Annotations used: <p>
* Fields with getters annotated as <code>@SpaceProperty(index=IndexType.BASIC)</code> are indexed.
* Querying indexed fields speeds up read and take operations.<p>
* <code>@SpaceClass</code> annotation in this example is only to indicate that this class is a space class.
*/
@SpaceClass
public class Account {
private String firstName;
private String lastName;
private Integer amount;
private Integer riskAllowed;
public Account () {
}
public Account(String firstName, String lastName, Integer amount, Integer riskAllowed) {
this.firstName=firstName;
this.lastName=lastName;
this.amount=amount;
this.riskAllowed=riskAllowed;
}
public Account(String firstName, String lastName, Integer amount) {
this.firstName=firstName;
this.lastName=lastName;
this.amount=amount;
}
public String toString() {
return("First Name ["+firstName+"] Last Name ["+lastName+"] Amount ["+amount+"] Risk Allowed Factor ["+riskAllowed+"]");
}
/**
* <code>@SpaceProperty</code> Defines this field data as indexed.
* Querying indexed fields speeds up read and take operations. Possible values of NONE and BASIC.
*/
@SpaceProperty(index=IndexType.BASIC)
public Integer getRiskAllowed() {
return riskAllowed;
}
public void setRiskAllowed(Integer riskAllowed) {
this.riskAllowed = riskAllowed;
}
@SpaceProperty(index=IndexType.BASIC)
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
@SpaceProperty(index=IndexType.BASIC)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@SpaceProperty(index=IndexType.BASIC)
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}