public class CacheableFactory extends Object
Cache.
Custom models for serialization can be implemented by overriding methods in this class to return them instead of the embedded ones.
To achieve this, extend CacheableFactory and activate it passing new instance of custom factory to setInstance(CacheableFactory) method.
Example usage:
CacheableFactory.setInstance(new YourCustomCacheableFactory());
// Custom cacheable factory is now in use. You can start rendering documents.
For more details, guidelines, and examples on customizing the cache, please refer to the GroupDocs.Viewer documentation.
| Constructor and Description |
|---|
CacheableFactory() |
| Modifier and Type | Method and Description |
|---|---|
static CacheableFactory |
getInstance()
Gets an instance of
CacheableFactory that can be used to create cacheable objects. |
ArchiveViewInfo |
newArchiveViewInfo(FileType fileType,
List<Page> pages,
List<String> folders)
Creates an implementation of the
ArchiveViewInfo interface for the specified file type, pages, and folders. |
Attachment |
newAttachment(String fileName,
String filePath)
Creates an implementation of the
Attachment interface. |
Attachment |
newAttachment(String id,
String fileName,
Path filePath,
long size)
Creates an implementation of the
Attachment interface. |
Attachment |
newAttachment(String id,
String fileName,
String filePath,
FileType fileType,
long size)
Creates an implementation of the
Attachment interface. |
Attachment |
newAttachment(String id,
String fileName,
String filePath,
long size)
Creates an implementation of the
Attachment interface. |
CadViewInfo |
newCadViewInfo(FileType fileType,
List<Page> pages,
List<Layer> layers,
List<Layout> layouts)
Creates an implementation of the
CadViewInfo interface with the specified file type, pages, layers, and layouts. |
Character |
newCharacter(char character,
double x,
double y,
double width,
double height)
Creates an implementation of the
Character interface for the specified character, position, and dimensions. |
FileInfo |
newFileInfo(FileType fileType)
Creates an implementation of the
FileInfo interface for the specified file type. |
Layer |
newLayer(String name)
Creates an implementation of the
Layer interface with the specified name. |
Layer |
newLayer(String name,
boolean visible)
Creates an implementation of the
Layer interface with the specified name and visibility. |
Layout |
newLayout(String name,
double width,
double height)
Creates an implementation of the
Layout interface with the specified name, width, and height. |
Line |
newLine(String line,
double x,
double y,
double width,
double height,
List<Word> words)
Creates an implementation of the
Line interface with the specified line, position, dimensions, and words. |
LotusNotesViewInfo |
newLotusNotesViewInfo(FileType fileType,
List<Page> pages,
int notesCount)
Creates an implementation of the
LotusNotesViewInfo interface for the specified file type, pages, and notes count. |
com.groupdocs.viewer.results.MboxViewInfo |
newMboxViewInfo(FileType fileType,
List<Page> pages,
int notesCount)
Creates an implementation of the
MboxViewInfo interface with the specified file type, pages, and notes count. |
OutlookViewInfo |
newOutlookViewInfo(FileType fileType,
List<Page> pages,
List<String> folders)
Creates an implementation of the
OutlookViewInfo interface based on the specified file type,
list of pages, and list of folders. |
Page |
newPage(int number,
boolean visible)
Creates an implementation of the
Page interface representing a page with the specified number and visibility. |
Page |
newPage(int number,
boolean visible,
int width,
int height)
Creates an implementation of the
Page interface representing a page with the specified number, visibility, width, and height. |
Page |
newPage(int number,
boolean visible,
int width,
int height,
List<Line> lines)
Creates an implementation of the
Page interface representing a page with the specified number, visibility, width, height, and lines. |
Page |
newPage(int number,
String name,
boolean visible)
Creates an implementation of the
Page interface representing a page with the specified number, name, and visibility. |
Page |
newPage(int number,
String name,
boolean visible,
int width,
int height)
Creates an implementation of the
Page interface representing a page with the specified number, name, visibility, width, and height. |
Page |
newPage(int number,
String name,
boolean visible,
int width,
int height,
List<Line> lines)
Creates an implementation of the
Page interface representing a page with the specified number, name, visibility, width, height, and lines. |
PdfViewInfo |
newPdfViewInfo(FileType fileType,
List<Page> pages,
boolean printingAllowed)
Creates an implementation of the
PdfViewInfo interface with the specified file type, pages, and printing allowed flag. |
ProjectManagementViewInfo |
newProjectManagementViewInfo(FileType fileType,
List<Page> pages,
Date startDate,
Date endDate)
Creates an implementation of the
ProjectManagementViewInfo interface with the specified file type, pages, start date, and end date. |
<T extends Serializable> |
newTextElement(T value,
double x,
double y,
double width,
double height)
Creates an implementation of the
TextElement interface with the specified value, coordinates, and dimensions. |
ViewInfo |
newViewInfo(FileType fileType,
List<Page> pages)
Creates an implementation of the
ViewInfo interface for the specified file type and pages. |
Word |
newWord(String word,
double x,
double y,
double width,
double height,
List<Character> characters)
Creates an implementation of the
Word interface with the specified word, coordinates, dimensions, and characters. |
static void |
setInstance(CacheableFactory instance)
Sets the instance of
CacheableFactory to be used. |
public static CacheableFactory getInstance()
Gets an instance of CacheableFactory that can be used to create cacheable objects.
CacheableFactory.public ArchiveViewInfo newArchiveViewInfo(FileType fileType, List<Page> pages, List<String> folders)
Creates an implementation of the ArchiveViewInfo interface for the specified file type, pages, and folders.
fileType - The file type.pages - The list of pages representing the document pages.folders - The list of folders in the archive.ArchiveViewInfo implementation.public Attachment newAttachment(String fileName, String filePath)
Creates an implementation of the Attachment interface.
fileName - The name of the attachment.filePath - The relative path of the attachment, e.g., "folder/file.docx". When the file is located in the root of an archive, in an email message, or a data file, specify the filename.Attachment implementation.public Attachment newAttachment(String id, String fileName, Path filePath, long size)
Creates an implementation of the Attachment interface.
id - The ID of the attachment.fileName - The name of the attachment.filePath - The relative or absolute path of the attachment.size - The size of the attachment.Attachment implementation.public Attachment newAttachment(String id, String fileName, String filePath, FileType fileType, long size)
Creates an implementation of the Attachment interface. The attachment represents a file attached to a document or an email message.
id - The ID of the attachment.fileName - The name of the attachment.filePath - The relative or absolute path of the attachment.
It can be a file path within a folder or the filename itself if the file is located in the root of an archive,
in an email message, or in a data file.fileType - The type of the attachment file.size - The size of the attachment.Attachment implementation.public Attachment newAttachment(String id, String fileName, String filePath, long size)
Creates an implementation of the Attachment interface.
id - The ID of the attachment.fileName - The name of the attachment.filePath - The relative path of the attachment, e.g., "folder/file.docx". When the file is located in the root of an archive, in an email message, or a data file, specify the filename.size - The size of the attachment.Attachment implementation.public CadViewInfo newCadViewInfo(FileType fileType, List<Page> pages, List<Layer> layers, List<Layout> layouts)
Creates an implementation of the CadViewInfo interface with the specified file type, pages, layers, and layouts.
fileType - The file type.pages - The list of pages.layers - The list of layers.layouts - The list of layouts.CadViewInfo implementation.public Character newCharacter(char character, double x, double y, double width, double height)
Creates an implementation of the Character interface for the specified character, position, and dimensions.
character - The character.x - The x-coordinate of the character position.y - The y-coordinate of the character position.width - The width of the character.height - The height of the character.Character implementation.public FileInfo newFileInfo(FileType fileType)
Creates an implementation of the FileInfo interface for the specified file type.
fileType - The file type.FileInfo implementation.public Layer newLayer(String name)
Creates an implementation of the Layer interface with the specified name.
name - The name of the layer.Layer implementation.public Layer newLayer(String name, boolean visible)
Creates an implementation of the Layer interface with the specified name and visibility.
name - The name of the layer.visible - The visibility of the layer.Layer implementation.public Layout newLayout(String name, double width, double height)
Creates an implementation of the Layout interface with the specified name, width, and height.
name - The name of the layout.width - The width of the layout.height - The height of the layout.Layout implementation.public Line newLine(String line, double x, double y, double width, double height, List<Word> words)
Creates an implementation of the Line interface with the specified line, position, dimensions, and words.
line - The line content.x - The X coordinate of the top-left point of the rectangle that contains the line.y - The Y coordinate of the top-left point of the rectangle that contains the line.width - The width of the rectangle that contains the line (in pixels).height - The height of the rectangle that contains the line (in pixels).words - The words contained in the line.Line implementation.public LotusNotesViewInfo newLotusNotesViewInfo(FileType fileType, List<Page> pages, int notesCount)
Creates an implementation of the LotusNotesViewInfo interface for the specified file type, pages, and notes count.
fileType - The file type.pages - The list of pages representing the document pages.notesCount - The count of Lotus Notes in the document.LotusNotesViewInfo implementation.public com.groupdocs.viewer.results.MboxViewInfo newMboxViewInfo(FileType fileType, List<Page> pages, int notesCount)
Creates an implementation of the MboxViewInfo interface with the specified file type, pages, and notes count.
fileType - The type of the file.pages - The list of pages to view.notesCount - The notes count contained by the Lotus database storage file.MboxViewInfo implementation.public OutlookViewInfo newOutlookViewInfo(FileType fileType, List<Page> pages, List<String> folders)
Creates an implementation of the OutlookViewInfo interface based on the specified file type,
list of pages, and list of folders.
fileType - The file type.pages - The list of pages.folders - The list of folders.OutlookViewInfo implementation.IllegalArgumentException - If any of the input parameters is null.public Page newPage(int number, boolean visible)
Creates an implementation of the Page interface representing a page with the specified number and visibility.
number - The page number.visible - The visibility flag.Page implementation.public Page newPage(int number, boolean visible, int width, int height)
Creates an implementation of the Page interface representing a page with the specified number, visibility, width, and height.
number - The page number.visible - The visibility flag.width - The width of the page.height - The height of the page.Page implementation.public Page newPage(int number, boolean visible, int width, int height, List<Line> lines)
Creates an implementation of the Page interface representing a page with the specified number, visibility, width, height, and lines.
number - The page number.visible - The visibility flag.width - The width of the page.height - The height of the page.lines - The lines contained in the page.Page implementation.public Page newPage(int number, String name, boolean visible)
Creates an implementation of the Page interface representing a page with the specified number, name, and visibility.
number - The page number.name - The page name.visible - The visibility flag.Page implementation.public Page newPage(int number, String name, boolean visible, int width, int height)
Creates an implementation of the Page interface representing a page with the specified number, name, visibility, width, and height.
number - The page number.name - The page name.visible - The visibility flag.width - The width of the page.height - The height of the page.Page implementation.public Page newPage(int number, String name, boolean visible, int width, int height, List<Line> lines)
Creates an implementation of the Page interface representing a page with the specified number, name, visibility, width, height, and lines.
number - The page number.name - The page name.visible - The visibility flag.width - The width of the page.height - The height of the page.lines - The lines contained in the page.Page implementation.public PdfViewInfo newPdfViewInfo(FileType fileType, List<Page> pages, boolean printingAllowed)
Creates an implementation of the PdfViewInfo interface with the specified file type, pages, and printing allowed flag.
fileType - The file type.pages - The list of pages.printingAllowed - The flag indicating whether printing is allowed.PdfViewInfo implementation.public ProjectManagementViewInfo newProjectManagementViewInfo(FileType fileType, List<Page> pages, Date startDate, Date endDate)
Creates an implementation of the ProjectManagementViewInfo interface with the specified file type, pages, start date, and end date.
fileType - The file type.pages - The list of pages.startDate - The start date.endDate - The end date.ProjectManagementViewInfo implementation.public <T extends Serializable> TextElement<T> newTextElement(T value, double x, double y, double width, double height)
Creates an implementation of the TextElement interface with the specified value, coordinates, and dimensions.
value - The value.x - The X coordinate.y - The Y coordinate.width - The width.height - The height.TextElement implementation.public ViewInfo newViewInfo(FileType fileType, List<Page> pages)
Creates an implementation of the ViewInfo interface for the specified file type and pages.
fileType - The file type.pages - The list of pages representing the document pages.ViewInfo implementation.public Word newWord(String word, double x, double y, double width, double height, List<Character> characters)
Creates an implementation of the Word interface with the specified word, coordinates, dimensions, and characters.
word - The word.x - The X coordinate of the highest left point on the page layout where the rectangle that contains the word begins.y - The Y coordinate of the highest left point on the page layout where the rectangle that contains the word begins.width - The width of the rectangle which contains the word (in pixels).height - The height of the rectangle which contains the word (in pixels).characters - The characters contained by the word.Word implementation.public static void setInstance(CacheableFactory instance)
Sets the instance of CacheableFactory to be used. This allows custom implementation of the cacheable factory.
instance - The instance of CacheableFactory to set.Copyright © 2025. All rights reserved.