• Peter Somogyvari 13
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hiya,


In my custom APEX REST endpoint, I want to have the exact same pagination as the SFDC REST API.
Is there an easier way to achieve this than implementing the logic from scratch? I would love to just extend abstract base class that holds all this logic and is used by the SFDC REST API as well. Or something similarly convenient, that doesn't involve me re-inventing the wheel.


Thanks in advance,
Peter
Hiya,


I need a BitList collection, that will be backing up a bloom filter implementation. The bloom filter will store large amounts of Salesforce IDs and need to be able to have add() and test() methods.
The BitList would need to be able to access bits via indices. If it returns elements as Booleans that's fine.

Is there any existing implementation out there that I could leverage?
Could someone point out the pitfalls here, what could be the best way to approach the problem?

I guess another question I need to ask is this: Is there any upside to implementing a BitList, instead of just using a standard Apex collection with Booleans? Note here: The BitList has to be serializable as well, I plan to use the new Platform Cache feature to store instances of BitLists.

Sketch of the interface as I imagine it: 

interface BitList {

  // constructor, initalises collection with given, fixed size and with all items as false initially
  public BitList(final Integer collectionSize);

  // constructor, initailises bit list from an array of integers (each bit of the integers become an item in the bitlist)
  // so an input of 5 integers of 32 bits each would result in a BitList with a size of 160 (5*32)
  public BitList(final Integer[] sourceBits);

  public void set(final Integer anIndex, final Boolean aBit);
  public Boolean get(final Integer anIndex);
  
  // Does this have to be implemented manually? Depends on the way bits are stored I guess.
  public String serialize();
}
Hiya,


In my custom APEX REST endpoint, I want to have the exact same pagination as the SFDC REST API.
Is there an easier way to achieve this than implementing the logic from scratch? I would love to just extend abstract base class that holds all this logic and is used by the SFDC REST API as well. Or something similarly convenient, that doesn't involve me re-inventing the wheel.


Thanks in advance,
Peter