|
/* * 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; // Constructors 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; } // toString Override public String toString() { return("First Name ["+firstName+"] Last Name ["+lastName+"] Amount ["+amount+"] Risk Allowed Factor ["+riskAllowed+"]"); } // Getters/Setters /** * <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; } } |
IMPORTANT: This is an old version of GigaSpaces XAP. Click here for the latest version.
GigaSpaces 6.0 Documentation Contents (Current Page in Bold)
(works on Firefox 2 and Internet Explorer 7)
Labels
(None)