-
Notifications
You must be signed in to change notification settings - Fork 196
Proposal for a patch for Imaging-159 using a POJO #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mgmechanics
wants to merge
179
commits into
apache:trunk
Choose a base branch
from
mgmechanics:IMAGING-159-POJO
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
179 commits
Select commit
Hold shift + click to select a range
16372b8
added class body
mgmechanics 217abfa
finished work for parameter verbose only (meant as example)
mgmechanics ddd2052
added code for strict-parameter; corrected verbose-pm regarding a def…
mgmechanics 584c46b
added code for fileName-parameter; corrected javadoc for verbose-para…
mgmechanics 1edd229
added code for PARAM_KEY_XMP_XML
mgmechanics b215e4b
corrected javadoc
mgmechanics 13a14d3
added code for PARAM_KEY_FORMAT
mgmechanics b8b1aef
added code for BUFFERED_IMAGE_FACTORY
mgmechanics 07f98aa
PARAM_KEY_PIXEL_DENSITY
mgmechanics 6957d07
corrected javadoc
mgmechanics 56e9fd1
let inherit check methods
mgmechanics 90377ff
added parameters for JPEG/JFIF
mgmechanics b7d5ce1
corrected javadoc
mgmechanics e4ca402
corrected javadoc
mgmechanics ff70685
doc
mgmechanics a5da7bd
added parameters for TIFF
mgmechanics 9f54d06
doc
mgmechanics 4189850
set default value for tiff compression
mgmechanics cc6ac0f
must have renamed verbose accidentally - corrected
mgmechanics 39b9e67
provided class variables for default values
mgmechanics 386c381
boolean parameters can be set via business methods
mgmechanics 38f4b82
typo
mgmechanics cff75ed
doc
mgmechanics 4712719
fixed boolean parameters (enable/disable)
mgmechanics 2c3d9ca
removed resetX() methods
mgmechanics 8ff6d0d
doc
mgmechanics ba7b7be
renamed parameter fileNameHint
mgmechanics f3605d3
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 95f01b6
fixed missing param tag
mgmechanics 9bf64f3
removed unused import
mgmechanics ab48433
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 259ae2b
added missing param tag
mgmechanics f5db3ba
added missing @throws tags
mgmechanics 4454b82
improved ensuring that the parameter object is not null
mgmechanics cede4fc
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics a6ac9ea
added missing @throws tags
mgmechanics b97e9ca
added note that I changed the file to licence header
mgmechanics 996abd1
added note that I changed the file to licence header
mgmechanics bfc72c3
removed prefix "Tiff"
mgmechanics 4a12446
added parameters for PCX (triggered by DcxImageParser.writeImage(fina…
mgmechanics 8db737c
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 81d32db
added missing @throws tags
mgmechanics 3a8e609
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics f8b45e3
added missing @throws tags to javadoc
mgmechanics 03ff8c7
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 3b8392b
added missing @throws tags to javadoc
mgmechanics c51a6e6
removed unused import
mgmechanics a32f119
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 0c6a0c1
added missing @throws tags to javadoc
mgmechanics e082094
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 4a1bf67
added missing @throws tags to javadoc
mgmechanics 13442b7
moved import for ImagingParameters on proper position
mgmechanics 8122d35
added missing @throws tags to javadoc
mgmechanics 83998e4
added bit depth
mgmechanics 3c58f66
removed default value for compression level
mgmechanics b203d5a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 8e26d53
added missing @throws tags to javadoc
mgmechanics 7bd251a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 479fee8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 7eb3b21
added missing @throws tags to javadoc
mgmechanics e2c8d09
added bit depth
mgmechanics e4e151d
set default values in constructor rather than in class
mgmechanics 5f063ee
added force indexed color and true color
mgmechanics 61b96ea
change types to native types were possible
mgmechanics c1a6979
change types to native types were possible
mgmechanics 2d0d773
change types to native types were possible
mgmechanics eb3ddfb
change types to native types were possible
mgmechanics bf067ac
change types to native types were possible
mgmechanics 9722ce1
removed default value for compression level
mgmechanics fc9bb64
added textChunks
mgmechanics 3f43350
added textChunks as List
mgmechanics 50601ae
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics a1d01d4
added parameters for PNM
mgmechanics 51a7b3c
renamed method
mgmechanics 5de82ae
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 3697cd9
removed unused import, added missing @throws tags to javadoc
mgmechanics 93085b5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 8d8c816
added note that I changed the file to licence header
mgmechanics 0562178
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 748f64f
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 8e1b272
added missing @throws tags to javadoc
mgmechanics ec03c5a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 05d111d
removed unused import
mgmechanics 60bb733
added note that I changed the file to licence header
mgmechanics 342ddf5
change types to native types were possible
mgmechanics ede24e3
renamed method
mgmechanics 44d89fe
Revert "renamed method"
mgmechanics 3f30ef9
renamed method
mgmechanics 9911252
typo
mgmechanics 92607ad
added readThumbnails
mgmechanics 215afc8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics a818a94
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics ee1f1a3
added compressionBlockSize
mgmechanics 331e3f2
added t4 and t6 options for Tiff
mgmechanics 016fdfd
improved readability of t4/t6 method names
mgmechanics 2c96cf5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 53168a6
added subimage x, y, width and height
mgmechanics 52a0c2b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics d8d628e
removed value which was never used
mgmechanics 13a1684
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics ce0e256
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics bf29c05
added missing @throws tags to javadoc
mgmechanics 2b6c1a2
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics ddac350
added missing @throws tags to javadoc
mgmechanics 1aa72c4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 49b3b0a
added missing @throws tags to javadoc
mgmechanics 9352398
corrected variable name
mgmechanics 1841900
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 4eb2a80
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 7ce092b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics c42bcc9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 2904fbe
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics d9f198c
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 37d7054
made field final
mgmechanics 223fbbf
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 7a5b3a9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics dd32969
made field final
mgmechanics 183e7a0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics bc349a0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics ffe3da4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 3ac6708
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics fa250a1
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 24315f9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics e33f8d2
made field final to get told if I broke something
mgmechanics 8f86045
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics f1dfdce
made field final to get told if I broke something
mgmechanics e67a700
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 11e23ec
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics fdd1249
made field final to get told if I broke something
mgmechanics 43ee3f1
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics cffd5ec
made field final to get told if I broke something
mgmechanics 55faed2
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 8ec13e8
made field final to get told if I broke something
mgmechanics 58a3155
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics d90b702
made field final to get told if I broke something
mgmechanics eb20439
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 15c16ae
made field final to get told if I broke something
mgmechanics be94d28
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics d3f735d
made field final to get told if I broke something
mgmechanics 6ad55c8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics bbb966b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 9497a46
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 9086d93
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics eaeddf5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics fc7bc8e
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 34e69d0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 4d6ee12
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 94402c4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 59cf880
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 39037ef
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics 5c55338
Replaced parameter Map<String, Object> by ImagingParameters - removed…
mgmechanics 5a45484
took over javadoc from class TiffConstants
mgmechanics 0a24438
took over javadoc from class TiffConstants
mgmechanics c976b8a
removed unused String PARAM_KEY_ fields
mgmechanics 749cbb2
removed unused String PARAM_KEY_ fields
mgmechanics 54ed80d
removed unused String PARAM_KEY_ fields
mgmechanics 819fee5
removed unused String PARAM_KEY_ fields
mgmechanics 6bc6883
fixed mistake: true must returned if the value is NOT null
mgmechanics b8a0266
removed unused imports
mgmechanics fb80d9f
if a parameter object is provided but there is no BufferedImageFactor…
mgmechanics 462a943
renamed some methods for accessing boolean parameters to have them al…
mgmechanics 4b79c82
removed comment about "Map params" argument because it was replaced b…
mgmechanics afce5be
setting read thumbnails param more elegant
mgmechanics f197352
doc
mgmechanics 2cbee0d
reverted unrelated modifications
mgmechanics 43e4431
doc
mgmechanics 8639f88
doc
mgmechanics 832402a
doc
mgmechanics 5d03d43
doc
mgmechanics 9521624
set missing default values
mgmechanics 405eab0
shortened field name
mgmechanics a1eaf9c
renamed method
mgmechanics 99bc27e
set parameter name in error message
mgmechanics ef43d0a
set parameter name in error message
mgmechanics c27bc68
added tests
mgmechanics 3817976
added more tests
mgmechanics 862469e
implemented plain setters even for boolean values
mgmechanics 42cc793
doc
mgmechanics d36b30d
fixed error in javadoc - replaced "{@false}" by "{@code false}"
mgmechanics File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ | |
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.apache.commons.imaging.common.BinaryFileParser; | ||
import org.apache.commons.imaging.common.BufferedImageFactory; | ||
|
@@ -76,24 +75,6 @@ | |
* the intentions of the original. Therefore, you should not assume | ||
* that the documentation is perfect, especially in the more obscure | ||
* and specialized areas of implementation. | ||
* | ||
* <h4>The "Map params" argument</h4> | ||
* | ||
* Many of the methods specified by this class accept an argument of | ||
* type Map giving a list of parameters to be used when processing an | ||
* image. For example, some of the output formats permit the specification | ||
* of different kinds of image compression or color models. Some of the | ||
* reading methods permit the calling application to require strict | ||
* format compliance. In many cases, however, an application will not | ||
* require the use of this argument. While some of the ImageParser | ||
* implementations check for (and ignore) null arguments for this parameter, | ||
* not all of them do (at least not at the time these notes were written). | ||
* Therefore, a prudent programmer will always supply an valid, though | ||
* empty instance of a Map implementation when calling such methods. | ||
* Generally, the java HashMap class is useful for this purpose. | ||
* | ||
* <p>Additionally, developers creating or enhancing classes derived | ||
* from ImageParser are encouraged to include such checks in their code. | ||
*/ | ||
public abstract class ImageParser extends BinaryFileParser { | ||
|
||
|
@@ -169,7 +150,7 @@ public final ImageMetadata getMetadata(final ByteSource byteSource) throws Image | |
* implementation. | ||
* @throws IOException In the event of unsuccessful data read operation. | ||
*/ | ||
public abstract ImageMetadata getMetadata(ByteSource byteSource, Map<String, Object> params) | ||
public abstract ImageMetadata getMetadata(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -215,7 +196,7 @@ public final ImageMetadata getMetadata(final byte[] bytes) throws ImageReadExcep | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful data read operation. | ||
*/ | ||
public final ImageMetadata getMetadata(final byte[] bytes, final Map<String, Object> params) | ||
public final ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
return getMetadata(new ByteSourceArray(bytes), params); | ||
} | ||
|
@@ -264,7 +245,7 @@ public final ImageMetadata getMetadata(final File file) throws ImageReadExceptio | |
* @throws IOException In the event of unsuccessful file read or | ||
* access operation. | ||
*/ | ||
public final ImageMetadata getMetadata(final File file, final Map<String, Object> params) | ||
public final ImageMetadata getMetadata(final File file, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
if (getDebug()) { | ||
System.out.println(getName() + ".getMetadata" + ": " | ||
|
@@ -302,7 +283,7 @@ public final ImageMetadata getMetadata(final File file, final Map<String, Object | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful data access operation. | ||
*/ | ||
public abstract ImageInfo getImageInfo(ByteSource byteSource, Map<String, Object> params) | ||
public abstract ImageInfo getImageInfo(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -348,7 +329,7 @@ public final ImageInfo getImageInfo(final ByteSource byteSource) throws ImageRea | |
* @throws IOException In the event of unsuccessful data | ||
* access operation. | ||
*/ | ||
public final ImageInfo getImageInfo(final byte[] bytes, final Map<String, Object> params) | ||
public final ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
return getImageInfo(new ByteSourceArray(bytes), params); | ||
} | ||
|
@@ -377,7 +358,7 @@ public final ImageInfo getImageInfo(final byte[] bytes, final Map<String, Object | |
* @throws IOException In the event of unsuccessful file read or | ||
* access operation. | ||
*/ | ||
public final ImageInfo getImageInfo(final File file, final Map<String, Object> params) | ||
public final ImageInfo getImageInfo(final File file, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
if (!canAcceptExtension(file)) { | ||
return null; | ||
|
@@ -505,7 +486,7 @@ public final List<BufferedImage> getAllBufferedImages(final File file) throws Im | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map<String, Object> params) | ||
public abstract BufferedImage getBufferedImage(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -523,7 +504,7 @@ public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map<String | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final BufferedImage getBufferedImage(final byte[] bytes, final Map<String, Object> params) | ||
public final BufferedImage getBufferedImage(final byte[] bytes, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
return getBufferedImage(new ByteSourceArray(bytes), params); | ||
} | ||
|
@@ -543,7 +524,7 @@ public final BufferedImage getBufferedImage(final byte[] bytes, final Map<String | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final BufferedImage getBufferedImage(final File file, final Map<String, Object> params) | ||
public final BufferedImage getBufferedImage(final File file, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
if (!canAcceptExtension(file)) { | ||
return null; | ||
|
@@ -575,7 +556,7 @@ public final BufferedImage getBufferedImage(final File file, final Map<String, O | |
* @throws IOException In the event of an write error from | ||
* the output stream. | ||
*/ | ||
public void writeImage(final BufferedImage src, final OutputStream os, final Map<String, Object> params) | ||
public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params) | ||
throws ImageWriteException, IOException { | ||
os.close(); // we are obligated to close stream. | ||
|
||
|
@@ -609,7 +590,7 @@ public final Dimension getImageSize(final byte[] bytes) throws ImageReadExceptio | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final Dimension getImageSize(final byte[] bytes, final Map<String, Object> params) | ||
public final Dimension getImageSize(final byte[] bytes, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
return getImageSize(new ByteSourceArray(bytes), params); | ||
} | ||
|
@@ -640,7 +621,7 @@ public final Dimension getImageSize(final File file) throws ImageReadException, | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final Dimension getImageSize(final File file, final Map<String, Object> params) | ||
public final Dimension getImageSize(final File file, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
|
||
if (!canAcceptExtension(file)) { | ||
|
@@ -662,7 +643,7 @@ public final Dimension getImageSize(final File file, final Map<String, Object> p | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public abstract Dimension getImageSize(ByteSource byteSource, Map<String, Object> params) | ||
public abstract Dimension getImageSize(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -682,7 +663,7 @@ public abstract Dimension getImageSize(ByteSource byteSource, Map<String, Object | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public abstract String getXmpXml(ByteSource byteSource, Map<String, Object> params) | ||
public abstract String getXmpXml(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -715,7 +696,7 @@ public final byte[] getICCProfileBytes(final byte[] bytes) throws ImageReadExcep | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final byte[] getICCProfileBytes(final byte[] bytes, final Map<String, Object> params) | ||
public final byte[] getICCProfileBytes(final byte[] bytes, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
return getICCProfileBytes(new ByteSourceArray(bytes), params); | ||
} | ||
|
@@ -750,7 +731,7 @@ public final byte[] getICCProfileBytes(final File file) throws ImageReadExceptio | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public final byte[] getICCProfileBytes(final File file, final Map<String, Object> params) | ||
public final byte[] getICCProfileBytes(final File file, final ImagingParameters params) | ||
throws ImageReadException, IOException { | ||
if (!canAcceptExtension(file)) { | ||
return null; | ||
|
@@ -777,7 +758,7 @@ public final byte[] getICCProfileBytes(final File file, final Map<String, Object | |
* parser implementation. | ||
* @throws IOException In the event of unsuccessful read or access operation. | ||
*/ | ||
public abstract byte[] getICCProfileBytes(ByteSource byteSource, Map<String, Object> params) | ||
public abstract byte[] getICCProfileBytes(ByteSource byteSource, final ImagingParameters params) | ||
throws ImageReadException, IOException; | ||
|
||
/** | ||
|
@@ -846,6 +827,7 @@ public final String dumpImageFile(final ByteSource byteSource) | |
* Write the ImageInfo and format-specific information for the image | ||
* content of the specified byte source to a PrintWriter | ||
* | ||
* @param pw | ||
* @param byteSource A valid byte source. | ||
* @return A valid PrintWriter. | ||
* @throws ImageReadException In the event that the the specified content | ||
|
@@ -954,13 +936,12 @@ protected final boolean canAcceptExtension(final String filename) { | |
* @param params A valid Map object, or a null. | ||
* @return A valid instance of an implementation of a IBufferedImageFactory. | ||
*/ | ||
protected BufferedImageFactory getBufferedImageFactory(final Map<String, Object> params) { | ||
if (params == null) { | ||
protected BufferedImageFactory getBufferedImageFactory(final ImagingParameters params) { | ||
if (params == null || params.isBufferedImageFactoryPresent() == false) { | ||
return new SimpleBufferedImageFactory(); | ||
} | ||
|
||
final BufferedImageFactory result = (BufferedImageFactory) params | ||
.get(ImagingConstants.BUFFERED_IMAGE_FACTORY); | ||
final BufferedImageFactory result = params.getBufferedImageFactory(); | ||
|
||
if (null != result) { | ||
return result; | ||
|
@@ -970,19 +951,18 @@ protected BufferedImageFactory getBufferedImageFactory(final Map<String, Object> | |
} | ||
|
||
/** | ||
* A utility method to search a params specification and determine | ||
* whether it contains the ImagingConstants.PARAM_KEY_STRICT | ||
* specification. Intended | ||
* for internal use by ImageParser implementations. | ||
* A utility method to whether we have a parameter object and if the STRICT | ||
* flag is set or not. | ||
* Intended for internal use by ImageParser implementations. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe some re-wording here "Return whether to use a strict mode or not when reading or writing images." or similar? |
||
* | ||
* @param params A valid Map object (or a null). | ||
* @param params A valid parameter object (or a null). | ||
* @return If the params specify strict format compliance, true; | ||
* otherwise, false. | ||
*/ | ||
public static boolean isStrict(final Map<String, Object> params) { | ||
if (params == null || !params.containsKey(ImagingConstants.PARAM_KEY_STRICT)) { | ||
public static boolean isStrict(final ImagingParameters params) { | ||
if (params == null) { | ||
return false; | ||
} | ||
return ((Boolean) params.get(ImagingConstants.PARAM_KEY_STRICT)).booleanValue(); | ||
return params.getStrict(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted in JIRA, to me it feels strange to pass a BufferedImageFactory via a parameters object. But since this has been the case before this PR, I think we should first concentrate on getting the ImagingParameters in place and refactor the BufferedImageFactory later (if that is possible)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, really strange. Perhaps if it were the class only, not the instance, then I think it'd be fine.