Top Description Inners Fields Constructors Methods
com.dlsc.pdfviewfx

public Class PDFView

extends Control
Class Inheritance
Imports
com.dlsc.pdfviewfx.PDFView.Document.DocumentProcessingException, com.dlsc.pdfviewfx.skins.PDFViewSkin, javafx.beans.property.*, javafx.collections.FXCollections, .ObservableList, javafx.geometry.Rectangle2D, javafx.scene.control.Control, .Skin, javafx.scene.paint.Color, java.awt.image.BufferedImage, java.awt.print.Pageable, java.io.File, .IOException, .InputStream, java.util.List, .Objects, java.util.function.Supplier

A PDF viewer based on Apache PDFBox. The view shows thumbnails on the left and the full page on the right. The user can zoom in, rotate, fit size, etc...

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PDFView.Document

The interface that needs to be implemented by any model object that represents a PDF document and that wants to be displayed by the view.

public static interface
PDFView.SearchableDocument

Documents that can be searched for a given text need to implement this interface and return a list of search results.

public static class
PDFView.SearchResult

Represent a single match in the document.

Field Summary

Modifier and TypeField and Description
private final BooleanProperty
cacheThumbnails

Caching thumbnails can be useful for low powered systems with enough memory.

private final ObjectProperty<PDFView.Document>
document

The currently loaded and displayed PDF document.

private final DoubleProperty
maxZoomFactor

Sets the upper bounds for zoom operations.

private final IntegerProperty
page

Stores the number of the currently showing page.

private final DoubleProperty
pageRotation

The page rotation in degrees.

private final FloatProperty
pageScale

The resolution / scale at which the main page will be rendered.

private final ObjectProperty<Color>
private final ListProperty<PDFView.SearchResult>
private final StringProperty
searchText

A text used for searching inside the document.

private final ObjectProperty<PDFView.SearchResult>
private final BooleanProperty
showAll

A flag that controls whether we always want to show the entire page.

private final BooleanProperty
showSearchResults

A flag used to control whether the view will display aggregated search results on the left-hand side.

private final BooleanProperty
showThumbnails

A flag used to control whether the view will display a thumbnail version of the pages on the left-hand side.

private final BooleanProperty
showToolBar

A flag used to control whether the view will include a toolbar with zoom, search, rotation controls.

private final FloatProperty
thumbnailPageScale

The resolution / scale at which the thumbnails will be rendered.

private final DoubleProperty
thumbnailSize

The size used for the images displayed in the thumbnail view.

private final DoubleProperty
zoomFactor

The current zoom factor.

Constructor Summary

AccessConstructor and Description
public
PDFView()

Constructs a new view.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<PDFView.Document>
public final PDFView.Document
public final double
public final int
public final double
public final float
public final Color
public final ObservableList<PDFView.SearchResult>
public final String
public final PDFView.SearchResult
public final float
public final double
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final double
public final boolean

Returns:

true if the operation actually did cause a page change
gotoLastPage
()

Convenience method to show the last page.

public final boolean

Returns:

true if the operation actually did cause a page change
gotoNextPage
()

Convenience method to show the next page.

public final boolean

Returns:

true if the operation actually did cause a page change
gotoPreviousPage
()

Convenience method to show the previous page.

public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final void
load(File
a file containing a PDF document
file
)

Loads the given PDF file.

public final void
load(InputStream
a stream returning a PDF document
stream
)

Loads the given PDF file.

public final void
load(Supplier<PDFView.Document>
Document supplier.
supplier
)

Sets the document retrieved from the given supplier.

public final DoubleProperty
public final IntegerProperty
public final DoubleProperty
public final FloatProperty
public final void
rotateLeft()

Convenience method to rotate the generated image by -90 degrees.

public final void
rotateRight()

Convenience method to rotate the generated image by +90 degrees.

public final ObjectProperty<Color>

Returns:

the search result highlight color
searchResultColorProperty
()

Stores the color to be used for highlighting search results.

public final ListProperty<PDFView.SearchResult>

Returns:

the search results
searchResultsProperty
()

Stores the list of currently found search results.

public final StringProperty
public final ObjectProperty<PDFView.SearchResult>

Returns:

the selected search result
selectedSearchResultProperty
()

Stores the currently selected search result.

public final void
setCacheThumbnails(boolean cacheThumbnails)

public final void
public final void
setMaxZoomFactor(double maxZoomFactor)

public final void
setPage(int page)

public final void
setPageRotation(double pageRotation)

public final void
setPageScale(float pageScale)

public final void
setSearchResultColor(Color searchResultColor)

public final void
public final void
setSearchText(String searchText)

public final void
public final void
setShowAll(boolean showAll)

public final void
setShowSearchResults(boolean showSearchResults)

public final void
setShowThumbnails(boolean showThumbnails)

public final void
setShowToolBar(boolean showToolBar)

public final void
setThumbnailPageScale(float thumbnailPageScale)

public final void
setThumbnailSize(double thumbnailSize)

public final void
setZoomFactor(double zoomFactor)

public final BooleanProperty
public final BooleanProperty
public final BooleanProperty
public final BooleanProperty
public final FloatProperty
public final DoubleProperty
public final void
unload()

Un-loads currently loaded document.

public final DoubleProperty
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetClassCssMetaDatagetContextMenugetControlCssMetaDatagetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

cacheThumbnailsback to summary
private final BooleanProperty cacheThumbnails

Caching thumbnails can be useful for low powered systems with enough memory. The default value is "true". When set to "true" each thumbnail image will be added to a hashmap cache, hence making it necessary to only render once.

documentback to summary
private final ObjectProperty<PDFView.Document> document

The currently loaded and displayed PDF document.

maxZoomFactorback to summary
private final DoubleProperty maxZoomFactor

Sets the upper bounds for zoom operations. The default value is "4".

pageback to summary
private final IntegerProperty page

Stores the number of the currently showing page.

pageRotationback to summary
private final DoubleProperty pageRotation

The page rotation in degrees. Supported values are only "0", "90", "180", "270", "360", ... multiples of "90".

pageScaleback to summary
private final FloatProperty pageScale

The resolution / scale at which the main page will be rendered. The default value is "4". The value has direct impact on the size of the images being generated and the memory requirements. Keep low on low powered / low resolution systems and high on large systems with hires displays.

searchResultColorback to summary
private final ObjectProperty<Color> searchResultColor
searchResultsback to summary
private final ListProperty<PDFView.SearchResult> searchResults
searchTextback to summary
private final StringProperty searchText

A text used for searching inside the document. Results will be highlighted.

selectedSearchResultback to summary
private final ObjectProperty<PDFView.SearchResult> selectedSearchResult
showAllback to summary
private final BooleanProperty showAll

A flag that controls whether we always want to show the entire page. If "true" then the page will be constantly resized to fit the viewport of the scroll pane in which it is showing. In this mode zooming is not possible.

showSearchResultsback to summary
private final BooleanProperty showSearchResults

A flag used to control whether the view will display aggregated search results on the left-hand side.

showThumbnailsback to summary
private final BooleanProperty showThumbnails

A flag used to control whether the view will display a thumbnail version of the pages on the left-hand side.

showToolBarback to summary
private final BooleanProperty showToolBar

A flag used to control whether the view will include a toolbar with zoom, search, rotation controls.

thumbnailPageScaleback to summary
private final FloatProperty thumbnailPageScale

The resolution / scale at which the thumbnails will be rendered. The default value is "1".

thumbnailSizeback to summary
private final DoubleProperty thumbnailSize

The size used for the images displayed in the thumbnail view. The default value is "200".

zoomFactorback to summary
private final DoubleProperty zoomFactor

The current zoom factor. The default value is "1".

Constructor Detail

PDFViewback to summary
public PDFView()

Constructs a new view.

Method Detail

cacheThumbnailsPropertyback to summary
public final BooleanProperty cacheThumbnailsProperty()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Returns:Skin<?>

new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.

Annotations
@Override
documentPropertyback to summary
public final ObjectProperty<PDFView.Document> documentProperty()
getDocumentback to summary
public final PDFView.Document getDocument()
getMaxZoomFactorback to summary
public final double getMaxZoomFactor()
getPageback to summary
public final int getPage()
getPageRotationback to summary
public final double getPageRotation()
getPageScaleback to summary
public final float getPageScale()
getSearchResultColorback to summary
public final Color getSearchResultColor()
getSearchResultsback to summary
public final ObservableList<PDFView.SearchResult> getSearchResults()
getSearchTextback to summary
public final String getSearchText()
getSelectedSearchResultback to summary
public final PDFView.SearchResult getSelectedSearchResult()
getThumbnailPageScaleback to summary
public final float getThumbnailPageScale()
getThumbnailSizeback to summary
public final double getThumbnailSize()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Returns:String

A string URL

Annotations
@Override
getZoomFactorback to summary
public final double getZoomFactor()
gotoLastPageback to summary
public final boolean gotoLastPage()

Convenience method to show the last page.

Returns:boolean

true if the operation actually did cause a page change

gotoNextPageback to summary
public final boolean gotoNextPage()

Convenience method to show the next page. This simply increases the pageProperty() value by 1.

Returns:boolean

true if the operation actually did cause a page change

gotoPreviousPageback to summary
public final boolean gotoPreviousPage()

Convenience method to show the previous page. This simply decreases the pageProperty() value by 1.

Returns:boolean

true if the operation actually did cause a page change

isCacheThumbnailsback to summary
public final boolean isCacheThumbnails()
isShowAllback to summary
public final boolean isShowAll()
isShowSearchResultsback to summary
public final boolean isShowSearchResults()
isShowThumbnailsback to summary
public final boolean isShowThumbnails()
isShowToolBarback to summary
public final boolean isShowToolBar()
loadback to summary
public final void load(File file)

Loads the given PDF file.

Parameters
file:File

a file containing a PDF document

Exceptions
DocumentProcessingException:
if there is an error while reading/parsing a document.
loadback to summary
public final void load(InputStream stream)

Loads the given PDF file.

Parameters
stream:InputStream

a stream returning a PDF document

Exceptions
DocumentProcessingException:
if there is an error while reading/parsing a document.
loadback to summary
public final void load(Supplier<PDFView.Document> supplier)

Sets the document retrieved from the given supplier.

Parameters
supplier:Supplier<PDFView.Document>

Document supplier.

Exceptions
DocumentProcessingException:
if there is an error while reading/parsing of a document.
maxZoomFactorPropertyback to summary
public final DoubleProperty maxZoomFactorProperty()
pagePropertyback to summary
public final IntegerProperty pageProperty()
pageRotationPropertyback to summary
public final DoubleProperty pageRotationProperty()
pageScalePropertyback to summary
public final FloatProperty pageScaleProperty()
rotateLeftback to summary
public final void rotateLeft()

Convenience method to rotate the generated image by -90 degrees.

rotateRightback to summary
public final void rotateRight()

Convenience method to rotate the generated image by +90 degrees.

searchResultColorPropertyback to summary
public final ObjectProperty<Color> searchResultColorProperty()

Stores the color to be used for highlighting search results.

Returns:ObjectProperty<Color>

the search result highlight color

searchResultsPropertyback to summary
public final ListProperty<PDFView.SearchResult> searchResultsProperty()

Stores the list of currently found search results.

Returns:ListProperty<PDFView.SearchResult>

the search results

See Also
setSearchText(String)
searchTextPropertyback to summary
public final StringProperty searchTextProperty()
selectedSearchResultPropertyback to summary
public final ObjectProperty<PDFView.SearchResult> selectedSearchResultProperty()

Stores the currently selected search result.

Returns:ObjectProperty<PDFView.SearchResult>

the selected search result

See Also
getSearchResults(), setSearchText(String)
setCacheThumbnailsback to summary
public final void setCacheThumbnails(boolean cacheThumbnails)
setDocumentback to summary
public final void setDocument(PDFView.Document document)
setMaxZoomFactorback to summary
public final void setMaxZoomFactor(double maxZoomFactor)
setPageback to summary
public final void setPage(int page)
setPageRotationback to summary
public final void setPageRotation(double pageRotation)
setPageScaleback to summary
public final void setPageScale(float pageScale)
setSearchResultColorback to summary
public final void setSearchResultColor(Color searchResultColor)
setSearchResultsback to summary
public final void setSearchResults(ObservableList<PDFView.SearchResult> searchResults)
setSearchTextback to summary
public final void setSearchText(String searchText)
setSelectedSearchResultback to summary
public final void setSelectedSearchResult(PDFView.SearchResult selectedSearchResult)
setShowAllback to summary
public final void setShowAll(boolean showAll)
setShowSearchResultsback to summary
public final void setShowSearchResults(boolean showSearchResults)
setShowThumbnailsback to summary
public final void setShowThumbnails(boolean showThumbnails)
setShowToolBarback to summary
public final void setShowToolBar(boolean showToolBar)
setThumbnailPageScaleback to summary
public final void setThumbnailPageScale(float thumbnailPageScale)
setThumbnailSizeback to summary
public final void setThumbnailSize(double thumbnailSize)
setZoomFactorback to summary
public final void setZoomFactor(double zoomFactor)
showAllPropertyback to summary
public final BooleanProperty showAllProperty()
showSearchResultsPropertyback to summary
public final BooleanProperty showSearchResultsProperty()
showThumbnailsPropertyback to summary
public final BooleanProperty showThumbnailsProperty()
showToolBarPropertyback to summary
public final BooleanProperty showToolBarProperty()
thumbnailPageScalePropertyback to summary
public final FloatProperty thumbnailPageScaleProperty()
thumbnailSizePropertyback to summary
public final DoubleProperty thumbnailSizeProperty()
unloadback to summary
public final void unload()

Un-loads currently loaded document.

zoomFactorPropertyback to summary
public final DoubleProperty zoomFactorProperty()
com.dlsc.pdfviewfx back to summary

public Interface PDFView.Document

Known Direct Subinterfaces
com.dlsc.pdfviewfx.PDFView.SearchableDocument

The interface that needs to be implemented by any model object that represents a PDF document and that wants to be displayed by the view.
See Also
setDocument(Document), PDFBoxDocument

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PDFView.Document.DocumentProcessingException

A specialized exception for signalling processing errors while reading / parsing a PDF file.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Closes the document.

public int

Returns:

the total number of pages
getNumberOfPages
()

Returns the total number of pages inside the document.

public Pageable

Returns:

a set of pages to be printed
getPageable
()

Returns a set of pages to be printed.

public boolean

Returns:

true if the page has to be shown in landscape mode
isLandscape
(int
the page
pageNumber
)

Determines if the given page has a landscape orientation.

public BufferedImage

Returns:

the generated buffered image
renderPage
(int
the page number
pageNumber
,
float
the scale
scale
)

Renders the page specified by the given number at the given scale.

Method Detail

closeback to summary
public void close()

Closes the document.

getNumberOfPagesback to summary
public int getNumberOfPages()

Returns the total number of pages inside the document.

Returns:int

the total number of pages

getPageableback to summary
public Pageable getPageable()

Returns a set of pages to be printed.

Returns:Pageable

a set of pages to be printed

isLandscapeback to summary
public boolean isLandscape(int pageNumber)

Determines if the given page has a landscape orientation.

Parameters
pageNumber:int

the page

Returns:boolean

true if the page has to be shown in landscape mode

renderPageback to summary
public BufferedImage renderPage(int pageNumber, float scale)

Renders the page specified by the given number at the given scale.

Parameters
pageNumber:int

the page number

scale:float

the scale

Returns:BufferedImage

the generated buffered image

com.dlsc.pdfviewfx back to summary

public Class PDFView.Document.DocumentProcessingException

extends RuntimeException
Class Inheritance

A specialized exception for signalling processing errors while reading / parsing a PDF file.

Constructor Summary

AccessConstructor and Description
public
DocumentProcessingException(Throwable
the reason for the exception
cause
)

Constructs a new processing exception wrapping the given cause.

Constructor Detail

DocumentProcessingExceptionback to summary
public DocumentProcessingException(Throwable cause)

Constructs a new processing exception wrapping the given cause.

Parameters
cause:Throwable

the reason for the exception

com.dlsc.pdfviewfx back to summary

public Interface PDFView.SearchableDocument

extends Document
Known Direct Implementers
com.dlsc.pdfviewfx.PDFBoxDocument

Documents that can be searched for a given text need to implement this interface and return a list of search results.

Method Summary

Modifier and TypeMethod and Description
public List<PDFView.SearchResult>

Returns:

the list of search results
getSearchResults
(String
the text for which to search
searchText
)

Returns the list of search results for the given search text.

Inherited from com.dlsc.pdfviewfx.PDFView.Document:
closegetNumberOfPagesgetPageableisLandscaperenderPage

Method Detail

getSearchResultsback to summary
public List<PDFView.SearchResult> getSearchResults(String searchText)

Returns the list of search results for the given search text.

Parameters
searchText:String

the text for which to search

Returns:List<PDFView.SearchResult>

the list of search results

com.dlsc.pdfviewfx back to summary

public Class PDFView.SearchResult

extends Object
implements Comparable<PDFView.SearchResult>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Represent a single match in the document.

Field Summary

Modifier and TypeField and Description
private final Rectangle2D
private final int
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
SearchResult(String
the text for which was searched
searchText
,
String
a snippet of the text found at the search hit location
textSnippet
,
int
the page where the result can be found
pageNumber
,
Rectangle2D
the visual bounds of the search hit
marker
)

Constructs a new search result.

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(PDFView.SearchResult
the object to be compared.
other
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Rectangle2D
public int
public Rectangle2D
getScaledMarker(double scale)

public String
public String
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

markerback to summary
private final Rectangle2D marker
pageNumberback to summary
private final int pageNumber
searchTextback to summary
private final String searchText
textSnippetback to summary
private final String textSnippet

Constructor Detail

SearchResultback to summary
public SearchResult(String searchText, String textSnippet, int pageNumber, Rectangle2D marker)

Constructs a new search result.

Parameters
searchText:String

the text for which was searched

textSnippet:String

a snippet of the text found at the search hit location

pageNumber:int

the page where the result can be found

marker:Rectangle2D

the visual bounds of the search hit

Method Detail

compareToback to summary
public int compareTo(PDFView.SearchResult other)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
other:PDFView.SearchResult

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getMarkerback to summary
public Rectangle2D getMarker()
getPageNumberback to summary
public int getPageNumber()
getScaledMarkerback to summary
public Rectangle2D getScaledMarker(double scale)
getSearchTextback to summary
public String getSearchText()
getTextSnippetback to summary
public String getTextSnippet()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override