-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
710 changed files
with
20,090 additions
and
2,113 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -27,8 +27,6 @@ This file is part of the iText (R) project. | |
/** | ||
* A base class which covers the range of exceptions which may occur when encoding a barcode using | ||
* the Writer framework. | ||
* | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
public final class WriterException extends ITextException { | ||
|
||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -33,9 +33,6 @@ This file is part of the iText (R) project. | |
* <p> | ||
* The ordering of bits is row-major. Within each int, the least significant bits are used first, | ||
* meaning they represent lower x values. This is compatible with BitArray's implementation. | ||
* | ||
* @author Sean Owen | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
final class BitMatrix { | ||
|
||
|
This file contains 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,9 +26,6 @@ This file is part of the iText (R) project. | |
* JAVAPORT: This should be combined with BitArray in the future, although that class is not yet | ||
* dynamically resizeable. This implementation is reasonable but there is a lot of function calling | ||
* in loops I'd like to get rid of. | ||
* | ||
* @author [email protected] (Satoru Takabayashi) - creator | ||
* @author [email protected] (Daniel Switkin) - ported from C++ | ||
*/ | ||
final class BitVector { | ||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -24,8 +24,6 @@ This file is part of the iText (R) project. | |
|
||
/** | ||
* This class implements an array of unsigned bytes. | ||
* | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
final class ByteArray { | ||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -29,8 +29,6 @@ This file is part of the iText (R) project. | |
* | ||
* JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned | ||
* -1, 0, and 1, I'm going to use less memory and go with bytes. | ||
* | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
public final class ByteMatrix { | ||
|
||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -24,8 +24,6 @@ This file is part of the iText (R) project. | |
|
||
/** | ||
* These are a set of hints that you may pass to Writers to specify their behavior. | ||
* | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
public final class EncodeHintType { | ||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -29,10 +29,6 @@ This file is part of the iText (R) project. | |
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author [email protected] (Satoru Takabayashi) - creator | ||
* @author [email protected] (Daniel Switkin) - ported from C++ | ||
*/ | ||
final class Encoder { | ||
|
||
// The original table is defined in the table 5 of JISX0510:2004 (p.19). | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -22,10 +22,6 @@ This file is part of the iText (R) project. | |
*/ | ||
package com.itextpdf.barcodes.qrcode; | ||
|
||
/** | ||
* @author [email protected] (Satoru Takabayashi) - creator | ||
* @author [email protected] (Daniel Switkin) - ported from C++ | ||
*/ | ||
final class MaskUtil { | ||
|
||
private MaskUtil() { | ||
|
This file contains 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 |
---|---|---|
|
@@ -24,10 +24,6 @@ This file is part of the iText (R) project. | |
|
||
import com.itextpdf.barcodes.exceptions.WriterException; | ||
|
||
/** | ||
* @author [email protected] (Satoru Takabayashi) - creator | ||
* @author [email protected] (Daniel Switkin) - ported from C++ | ||
*/ | ||
final class MatrixUtil { | ||
|
||
private MatrixUtil() { | ||
|
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -22,10 +22,6 @@ This file is part of the iText (R) project. | |
*/ | ||
package com.itextpdf.barcodes.qrcode; | ||
|
||
/** | ||
* @author [email protected] (Satoru Takabayashi) - creator | ||
* @author [email protected] (Daniel Switkin) - ported from C++ | ||
*/ | ||
final class QRCode { | ||
|
||
public static final int NUM_MASK_PATTERNS = 8; | ||
|
This file contains 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 |
---|---|---|
|
@@ -28,8 +28,6 @@ This file is part of the iText (R) project. | |
|
||
/** | ||
* This object renders a QR Code as a ByteMatrix 2D array of greyscale values. | ||
* | ||
* @author [email protected] (Daniel Switkin) | ||
*/ | ||
public final class QRCodeWriter { | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
92 changes: 92 additions & 0 deletions
92
commons/src/main/java/com/itextpdf/commons/utils/DIContainer.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.itextpdf.commons.utils; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* A simple dependency injection container. | ||
* <p> | ||
* The container is thread-safe. | ||
*/ | ||
public class DIContainer { | ||
|
||
private static final ConcurrentHashMap<Class<?>, Supplier<Object>> instances = new ConcurrentHashMap<>(); | ||
|
||
private final ConcurrentHashMap<Class<?>, Object> localInstances = new ConcurrentHashMap<>(); | ||
|
||
static { | ||
DIContainerConfigurations.loadDefaultConfigurations(); | ||
} | ||
|
||
|
||
/** | ||
* Creates a new instance of {@link DIContainer}. | ||
*/ | ||
public DIContainer() { | ||
// Empty constructor | ||
} | ||
|
||
/** | ||
* Registers a default instance for a class. | ||
* | ||
* @param clazz the class | ||
* @param supplier supplier of the instance | ||
*/ | ||
public static void registerDefault(Class<?> clazz, Supplier<Object> supplier) { | ||
instances.put(clazz, supplier); | ||
} | ||
|
||
/** | ||
* Registers an instance for a class. | ||
* | ||
* @param clazz the class | ||
* @param inst the instance | ||
*/ | ||
public void register(Class<?> clazz, Object inst) { | ||
localInstances.put(clazz, inst); | ||
} | ||
|
||
/** | ||
* Gets an instance of a class. | ||
* | ||
* @param clazz the class | ||
* @param <T> the type of the class | ||
* | ||
* @return the instance | ||
*/ | ||
public <T> T getInstance(Class<T> clazz) { | ||
Object supplier = localInstances.get(clazz); | ||
if (supplier == null) { | ||
supplier = instances.get(clazz).get(); | ||
} | ||
if (supplier == null) { | ||
throw new RuntimeException("No instance registered for class " + clazz.getName()); | ||
} | ||
return (T) supplier; | ||
} | ||
|
||
|
||
} | ||
|
44 changes: 44 additions & 0 deletions
44
commons/src/main/java/com/itextpdf/commons/utils/DIContainerConfigurations.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2023 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.itextpdf.commons.utils; | ||
|
||
public class DIContainerConfigurations { | ||
|
||
private DIContainerConfigurations() { | ||
// Empty constructor | ||
} | ||
|
||
private static final String[] DEFAULT_CONFIGURATIONS_CLASS = new String[] { | ||
"com.itextpdf.forms.util.RegisterDefaultDiContainer" | ||
}; | ||
|
||
public static void loadDefaultConfigurations() { | ||
for (final String defaultConfigurationClass : DEFAULT_CONFIGURATIONS_CLASS) { | ||
try { | ||
Class.forName(defaultConfigurationClass); | ||
} catch (ClassNotFoundException e) { | ||
// Ignore | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.