CacheableFactory

Inheritance: java.lang.Object

public class CacheableFactory

This class helps customize 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.

Constructors

Constructor Description
CacheableFactory()

Methods

Method Description
getInstance() Gets an instance of CacheableFactory that can be used to create cacheable objects.
setInstance(CacheableFactory instance) Sets the instance of CacheableFactory to be used.
newViewInfo(FileType fileType, List pages) Creates an implementation of the ViewInfo interface for the specified file type and pages.
newLotusNotesViewInfo(FileType fileType, List pages, int notesCount) Creates an implementation of the LotusNotesViewInfo interface for the specified file type, pages, and notes count.
newArchiveViewInfo(FileType fileType, List pages, List folders) Creates an implementation of the ArchiveViewInfo interface for the specified file type, pages, and folders.
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.
newFileInfo(FileType fileType) Creates an implementation of the FileInfo interface for the specified file type.
newLayer(String name, boolean visible) Creates an implementation of the Layer interface with the specified name and visibility.
newLayer(String name) Creates an implementation of the Layer interface with the specified name.
newLayout(String name, double width, double height) Creates an implementation of the Layout interface with the specified name, width, and height.
newLine(String line, double x, double y, double width, double height, List words) Creates an implementation of the Line interface with the specified line, position, dimensions, and words.
newAttachment(String fileName, String filePath) Creates an implementation of the Attachment interface.
newAttachment(String id, String fileName, String filePath, long size) Creates an implementation of the Attachment interface.
newAttachment(String id, String fileName, Path filePath, long size) Creates an implementation of the Attachment interface.
newAttachment(String id, String fileName, String filePath, FileType fileType, long size) Creates an implementation of the Attachment interface.
newOutlookViewInfo(FileType fileType, List pages, List folders) Creates an implementation of the OutlookViewInfo interface based on the specified file type, list of pages, and list of folders.
newPage(int number, boolean visible) Creates an implementation of the Page interface representing a page with the specified number and visibility.
newPage(int number, String name, boolean visible) Creates an implementation of the Page interface representing a page with the specified number, name, and visibility.
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.
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.
newPage(int number, String name, boolean visible, int width, int height, List lines) Creates an implementation of the Page interface representing a page with the specified number, name, visibility, width, height, and lines.
newPage(int number, boolean visible, int width, int height, List lines) Creates an implementation of the Page interface representing a page with the specified number, visibility, width, height, and lines.
newPdfViewInfo(FileType fileType, List pages, boolean printingAllowed) Creates an implementation of the PdfViewInfo interface with the specified file type, pages, and printing allowed flag.
newCadViewInfo(FileType fileType, List pages, List layers, List layouts) Creates an implementation of the CadViewInfo interface with the specified file type, pages, layers, and layouts.
newProjectManagementViewInfo(FileType fileType, List pages, Date startDate, Date endDate) Creates an implementation of the ProjectManagementViewInfo interface with the specified file type, pages, start date, and end date.
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.
newMboxViewInfo(FileType fileType, List pages, int notesCount) Creates an implementation of the MboxViewInfo interface with the specified file type, pages, and notes count.
newWord(String word, double x, double y, double width, double height, List characters) Creates an implementation of the Word interface with the specified word, coordinates, dimensions, and characters.

CacheableFactory()

public CacheableFactory()

getInstance()

public static CacheableFactory getInstance()

Gets an instance of CacheableFactory that can be used to create cacheable objects.

Returns: CacheableFactory - an instance of CacheableFactory .

setInstance(CacheableFactory instance)

public static void setInstance(CacheableFactory instance)

Sets the instance of CacheableFactory to be used. This allows custom implementation of the cacheable factory.

Parameters:

Parameter Type Description
instance CacheableFactory The instance of CacheableFactory to set.

newViewInfo(FileType fileType, List pages)

public ViewInfo newViewInfo(FileType fileType, List<Page> pages)

Creates an implementation of the ViewInfo interface for the specified file type and pages.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages representing the document pages.

Returns: ViewInfo - a new instance of the ViewInfo implementation.

newLotusNotesViewInfo(FileType fileType, List pages, int notesCount)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages representing the document pages.
notesCount int The count of Lotus Notes in the document.

Returns: LotusNotesViewInfo - a new instance of the LotusNotesViewInfo implementation.

newArchiveViewInfo(FileType fileType, List pages, List folders)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages representing the document pages.
folders java.util.List<java.lang.String> The list of folders in the archive.

Returns: ArchiveViewInfo - a new instance of the ArchiveViewInfo implementation.

newCharacter(char character, double x, double y, double width, double height)

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.

Parameters:

Parameter Type Description
character char The character.
x double The x-coordinate of the character position.
y double The y-coordinate of the character position.
width double The width of the character.
height double The height of the character.

Returns: Character - a new instance of the Character implementation.

newFileInfo(FileType fileType)

public FileInfo newFileInfo(FileType fileType)

Creates an implementation of the FileInfo interface for the specified file type.

Parameters:

Parameter Type Description
fileType FileType The file type.

Returns: FileInfo - a new instance of the FileInfo implementation.

newLayer(String name, boolean visible)

public Layer newLayer(String name, boolean visible)

Creates an implementation of the Layer interface with the specified name and visibility.

Parameters:

Parameter Type Description
name java.lang.String The name of the layer.
visible boolean The visibility of the layer.

Returns: Layer - a new instance of the Layer implementation.

newLayer(String name)

public Layer newLayer(String name)

Creates an implementation of the Layer interface with the specified name.

Parameters:

Parameter Type Description
name java.lang.String The name of the layer.

Returns: Layer - a new instance of the Layer implementation.

newLayout(String name, double width, double height)

public Layout newLayout(String name, double width, double height)

Creates an implementation of the Layout interface with the specified name, width, and height.

Parameters:

Parameter Type Description
name java.lang.String The name of the layout.
width double The width of the layout.
height double The height of the layout.

Returns: Layout - a new instance of the Layout implementation.

newLine(String line, double x, double y, double width, double height, List words)

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.

Parameters:

Parameter Type Description
line java.lang.String The line content.
x double The X coordinate of the top-left point of the rectangle that contains the line.
y double The Y coordinate of the top-left point of the rectangle that contains the line.
width double The width of the rectangle that contains the line (in pixels).
height double The height of the rectangle that contains the line (in pixels).
words java.util.List<com.groupdocs.viewer.results.Word> The words contained in the line.

Returns: Line - a new instance of the Line implementation.

newAttachment(String fileName, String filePath)

public Attachment newAttachment(String fileName, String filePath)

Creates an implementation of the Attachment interface.

Parameters:

Parameter Type Description
fileName java.lang.String The name of the attachment.
filePath java.lang.String 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.

Returns: Attachment - a new instance of the Attachment implementation.

newAttachment(String id, String fileName, String filePath, long size)

public Attachment newAttachment(String id, String fileName, String filePath, long size)

Creates an implementation of the Attachment interface.

Parameters:

Parameter Type Description
id java.lang.String The ID of the attachment.
fileName java.lang.String The name of the attachment.
filePath java.lang.String 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 long The size of the attachment.

Returns: Attachment - a new instance of the Attachment implementation.

newAttachment(String id, String fileName, Path filePath, long size)

public Attachment newAttachment(String id, String fileName, Path filePath, long size)

Creates an implementation of the Attachment interface.

Parameters:

Parameter Type Description
id java.lang.String The ID of the attachment.
fileName java.lang.String The name of the attachment.
filePath java.nio.file.Path The relative or absolute path of the attachment.
size long The size of the attachment.

Returns: Attachment - a new instance of the Attachment implementation.

newAttachment(String id, String fileName, String filePath, FileType fileType, long size)

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.

Parameters:

Parameter Type Description
id java.lang.String The ID of the attachment.
fileName java.lang.String The name of the attachment.
filePath java.lang.String 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 FileType The type of the attachment file.
size long The size of the attachment.

Returns: Attachment - a new instance of the Attachment implementation.

newOutlookViewInfo(FileType fileType, List pages, List folders)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages.
folders java.util.List<java.lang.String> The list of folders.

Returns: OutlookViewInfo - a new instance of the OutlookViewInfo implementation.

newPage(int number, boolean visible)

public Page newPage(int number, boolean visible)

Creates an implementation of the Page interface representing a page with the specified number and visibility.

Parameters:

Parameter Type Description
number int The page number.
visible boolean The visibility flag.

Returns: Page - a new instance of the Page implementation.

newPage(int number, String name, boolean visible)

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.

Parameters:

Parameter Type Description
number int The page number.
name java.lang.String The page name.
visible boolean The visibility flag.

Returns: Page - a new instance of the Page implementation.

newPage(int number, String name, boolean visible, int width, int height)

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.

Parameters:

Parameter Type Description
number int The page number.
name java.lang.String The page name.
visible boolean The visibility flag.
width int The width of the page.
height int The height of the page.

Returns: Page - a new instance of the Page implementation.

newPage(int number, boolean visible, int width, int height)

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.

Parameters:

Parameter Type Description
number int The page number.
visible boolean The visibility flag.
width int The width of the page.
height int The height of the page.

Returns: Page - a new instance of the Page implementation.

newPage(int number, String name, boolean visible, int width, int height, List lines)

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.

Parameters:

Parameter Type Description
number int The page number.
name java.lang.String The page name.
visible boolean The visibility flag.
width int The width of the page.
height int The height of the page.
lines java.util.List<com.groupdocs.viewer.results.Line> The lines contained in the page.

Returns: Page - a new instance of the Page implementation.

newPage(int number, boolean visible, int width, int height, List lines)

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.

Parameters:

Parameter Type Description
number int The page number.
visible boolean The visibility flag.
width int The width of the page.
height int The height of the page.
lines java.util.List<com.groupdocs.viewer.results.Line> The lines contained in the page.

Returns: Page - a new instance of the Page implementation.

newPdfViewInfo(FileType fileType, List pages, boolean printingAllowed)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages.
printingAllowed boolean The flag indicating whether printing is allowed.

Returns: PdfViewInfo - a new instance of the PdfViewInfo implementation.

newCadViewInfo(FileType fileType, List pages, List layers, List layouts)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages.
layers java.util.List<com.groupdocs.viewer.results.Layer> The list of layers.
layouts java.util.List<com.groupdocs.viewer.results.Layout> The list of layouts.

Returns: CadViewInfo - a new instance of the CadViewInfo implementation.

newProjectManagementViewInfo(FileType fileType, List pages, Date startDate, Date endDate)

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.

Parameters:

Parameter Type Description
fileType FileType The file type.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages.
startDate java.util.Date The start date.
endDate java.util.Date The end date.

Returns: ProjectManagementViewInfo - a new instance of the ProjectManagementViewInfo implementation.

newTextElement(T value, double x, double y, double width, double height)

public TextElement<T> <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.

Parameters:

Parameter Type Description
value T The value.
x double The X coordinate.
y double The Y coordinate.
width double The width.
height double The height.

Returns: TextElement - a new instance of the TextElement implementation.

newMboxViewInfo(FileType fileType, List pages, int notesCount)

public 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.

Parameters:

Parameter Type Description
fileType FileType The type of the file.
pages java.util.List<com.groupdocs.viewer.results.Page> The list of pages to view.
notesCount int The notes count contained by the Lotus database storage file.

Returns: com.groupdocs.viewer.results.MboxViewInfo - a new instance of the MboxViewInfo implementation.

newWord(String word, double x, double y, double width, double height, List characters)

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.

Parameters:

Parameter Type Description
word java.lang.String The word.
x double The X coordinate of the highest left point on the page layout where the rectangle that contains the word begins.
y double The Y coordinate of the highest left point on the page layout where the rectangle that contains the word begins.
width double The width of the rectangle which contains the word (in pixels).
height double The height of the rectangle which contains the word (in pixels).
characters java.util.List<com.groupdocs.viewer.results.Character> The characters contained by the word.

Returns: Word - a new instance of the Word implementation.