|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.system.ObjectGroup
public final class ObjectGroup
Object groups
An object group is a collection of objects which all reside in the same filesystem record.
Use the ObjectGroup class to consolidate persistent object handles for an object into one
group and reduce the number of persistent object handles being used by the system. The number of
available persistent object handles is determined by a handheld device's flash memory and an application's data
structures. Consolidating persistent object handles reduces the number of used object handles.
Consider a record that contains 10 string fields. This record consumes 11 persistent object handles.
Using the ObjectGroup class to group the record, just one object handle is used for the record instead of 11.
The persistent object handles for the String fields are consolidated under the record object handle.
A grouped object is read-only. Attempting to modify a grouped object without ungrouping it throws an
ObjectGroupReadOnlyException.
See 'Memory Best Practices for the BlackBerry Java Development Environment' for more information.
Example
// AddressbookEntry class. public class AddressbookEntry { private String _firstname; private String _lastname; // ... } // Some other class... // Using Object Grouping for the AddressbookEntryClass: private static addAddressbookEntry( firstnameString, lastnameString ) { AddressbookEntry entry = new AddressbookEntry( firstname, lastname); // Consumes 3 object handle. ObjectGroup.createGroup(entry); // Consumes only 1 object handle Addressbook.getInstance().add( entry ); } private static editEntry( index int) { AddressbookEntry entry = Addressbook.getInstance().get( index ); if (ObjectGroup.isInGroup( entry ) { entry = (AddressbookEntry)ObjectGroup.expandGroup( entry ); } // Perform editing of object as usual... }
Method Summary | ||
---|---|---|
|
static void |
createGroup(Object obj)
Groups an object and everything it references to (recursively) into one orphan filesystem record. |
|
static void |
createGroupIgnoreTooBig(Object obj)
Groups an object and everything it references to (recursively) into one orphan filesystem record. |
|
static Object |
expandGroup(Object obj)
Ungroups an object. |
|
static boolean |
isInGroup(Object obj)
Indicates whether an object is grouped. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void createGroup(Object obj)
obj
- the object to group
ObjectGroupTooBigException
- if there are too many objects to fit in 64kpublic static void createGroupIgnoreTooBig(Object obj)
obj
- the object to grouppublic static Object expandGroup(Object obj)
obj
- The object to ungroup.
IllegalArgumentException
- if obj
is not the root of an ObjectGroup
.public static boolean isInGroup(Object obj)
obj
- The object to check.
true
if obj
is grouped, false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal