|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.gigaspaces.converter.pojo.ConverterHelper com.gigaspaces.converter.pojo.Pojo2ExternalEntryConverter
public class Pojo2ExternalEntryConverter
This class is the implementation of the interface IPojoToEntryConverter. It has two major public methods: toEntry(Object POJO), and toPojo(Entry entry). The method toEntry(Object POJO) converts the POJO(java bean) into a GigaSpaces ExternalEntry object. The method toPojo(Entry entry) transforms the GigaSpaces ExternalEntry object into a POJO. This class extends the ConverterHelper.java class, which initiates the POJODescription object for each POJO. The POJODescriptor is initiated by parsing a gs.xml file, or by an annotation if the gs.xml file does not exist which describes the map values of the * POJO to the Entry.
Constructor Summary | |
---|---|
Pojo2ExternalEntryConverter()
Empty constructor |
|
Pojo2ExternalEntryConverter(boolean isInvokePropSet)
Constructor |
Method Summary | |
---|---|
void |
clean()
Clean all the caching data from the converter |
String |
createUid(Object pojo)
return the UID from a pojo. |
List<ExternalEntry> |
getDescribedClasses()
Gets all the ExternalEntry objects from all the classes that have a POJODescriptor object. |
String |
getEntryUID(Entry entry)
Check if the object is instance of IMetaData and has primary key or Entry and contains "__getEntryUid" method. |
ExternalEntry |
getExternalEntry(ExternalEntry externlaEntry,
boolean isFullMetaData)
Gets the ExternalEntry of the class. |
Object |
getPOJOHashValue(Object value)
|
String |
getPojoOrEntryPk(Object object)
Check if the Object has a primary key field and not null |
int |
getPojoVersion(Object pojo)
|
IJSpace |
getSpace()
Gets the space |
static List<String> |
getSuperClasses(Class pojoClass)
Gets the super classes of the POJO |
long |
getTimeToLive(Object pojo)
|
boolean |
needUid(Object pojo)
checks if the userData has a place to put the UID and it is still empty. |
void |
setPOJOEntryInfo(Object pojo,
String uid,
Object oldEntry)
|
void |
setPOJOVersion(Object pojo,
int version)
|
void |
setSpace(IJSpace space)
Sets the space |
IGSEntry |
toEntry(Object pojo)
Transforms the supplied POJO (Plain Old Java Object) into an ExternalEntry object, using the POJODescription object, which maps the POJO fields into the space Entry. |
IGSEntry |
toEntry(Object pojo,
boolean isIgnoreGenerateAutoPK)
Converts a POJO that has a primary key and auto-generator declared, and you don't want to generate the primary key. |
Object |
toPojo(Entry entry)
Transforms the supplied Entry into a POJO (Plain Old Java Object), according to some specific policy or implementation. |
Object |
toPojoFromIGSEntry(IGSEntry igsEntry)
Transforms the supplied IGSEntry into a POJO (Plain Old Java Object). |
void |
updatePOJOFromIGSEntry(IGSEntry igsEntry,
Object pojo)
Update the POJO with the IGSEntry parameters that return from the space. |
void |
updatePOJOFromIGSEntry(IGSEntry igsEntry,
Object pojo,
com.gigaspaces.converter.pojo.POJODescription pojoDescription)
Updates the POJO with the IGSEntry parameters that are returned from the space. |
void |
updatePojoWithAutoUID(Object pojo,
String UID,
com.gigaspaces.converter.pojo.POJODescription pojoDescription)
Update the POJO auto generate primary key fields with the generate uid's |
Methods inherited from class com.gigaspaces.converter.pojo.ConverterHelper |
---|
afterPropertiesSet, getConfiguration, getFile, getInputStream, getURL, setMappingDirectoryLocations, setMappingJarLocations, setMappingResources |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Pojo2ExternalEntryConverter()
public Pojo2ExternalEntryConverter(boolean isInvokePropSet)
isInvokePropSet
- indicate if to invoke the method
afterProertiesSet() after setMapping..() methodsMethod Detail |
---|
public IGSEntry toEntry(Object pojo)
toEntry
in interface IPojoToEntryConverter
pojo
- The POJO that is converted.
public IGSEntry toEntry(Object pojo, boolean isIgnoreGenerateAutoPK)
toEntry
in interface IPojoToEntryConverter
pojo
- the POJOisIgnoreGenerateAutoPK
- boolean Indicates that the POJO has a
primary key and an auto-generator declared, and you don't want
to generate the primary key.
InvocationTargetException
IllegalAccessException
IllegalArgumentException
public Object toPojo(Entry entry)
toPojo
in interface IPojoToEntryConverter
entry.
-
public Object toPojoFromIGSEntry(IGSEntry igsEntry)
toPojoFromIGSEntry
in interface IPojoToEntryConverter
igsEntry
- - The IGSEntry.
InvocationTargetException
IllegalAccessException
IllegalArgumentException
IllegalAccessException
InstantiationException
public void updatePOJOFromIGSEntry(IGSEntry igsEntry, Object pojo, com.gigaspaces.converter.pojo.POJODescription pojoDescription) throws ConversionException
igsEntry
- The IGSEntry returned from the space.pojo
- The POJO to be updated.
ConversionException
- If an error occurred.public void updatePOJOFromIGSEntry(IGSEntry igsEntry, Object pojo) throws ConversionException
igsEntry
- the IGSEntry that came form the space.pojo
- the POJO to be update
ConversionException
- if some went wrongpublic void setSpace(IJSpace space)
space
- public IJSpace getSpace()
public void updatePojoWithAutoUID(Object pojo, String UID, com.gigaspaces.converter.pojo.POJODescription pojoDescription) throws Throwable
pojo
- - The POJO objectUID
- - the id
Throwable
public static List<String> getSuperClasses(Class pojoClass)
pojoClass
- - The POJO class name
public String getPojoOrEntryPk(Object object)
object
- the class name of the pojo or entry.
public void clean()
clean
in interface IPojoToEntryConverter
public List<ExternalEntry> getDescribedClasses() throws Throwable
Throwable
public ExternalEntry getExternalEntry(ExternalEntry externlaEntry, boolean isFullMetaData) throws ClassNotFoundException
externlaEntry
- The incomplete ExternalEntry.isFullMetaData
- Indicates if to fill the ExternalEntry with all of the data.
ClassNotFoundException
public String getEntryUID(Entry entry) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
entry
- the entry
InvocationTargetException
IllegalAccessException
IllegalArgumentException
public Object getPOJOHashValue(Object value)
public void setPOJOEntryInfo(Object pojo, String uid, Object oldEntry)
public int getPojoVersion(Object pojo)
public void setPOJOVersion(Object pojo, int version)
public String createUid(Object pojo) throws ConversionException
pojo
-
ConversionException
- in case SpaceId wasn't define in the object.public long getTimeToLive(Object pojo)
public boolean needUid(Object pojo)
pojo
- to check
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |