-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for CharTagMapBuilder.withTagLengthSwap
Ability to change the order of Tag and Length tags.
- Loading branch information
Showing
4 changed files
with
76 additions
and
4 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
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 |
---|---|---|
|
@@ -19,7 +19,10 @@ | |
package org.jpos.tlv; | ||
|
||
/** | ||
* Builder to create TLV tag maps stored as sequence of characters. | ||
* Builder to create TLV/LTV tag maps stored as sequence of characters. | ||
* <p> | ||
* Using {@code withTagLengthSwap(true)} while creating the builder causes | ||
* switchs {@code CharTagMap} in LTV mode. | ||
* | ||
* @author Robert Demski <[email protected]> | ||
*/ | ||
|
@@ -28,6 +31,8 @@ public class CharTagMapBuilder { | |
protected Integer tagSize; | ||
protected Integer lengthSize; | ||
|
||
protected boolean swapTagWithLength; | ||
|
||
/** | ||
* Constructs a new instance of the builder. | ||
*/ | ||
|
@@ -57,6 +62,17 @@ public CharTagMapBuilder withTagSize(int size) { | |
return this; | ||
} | ||
|
||
/** | ||
* Swap Tag with Length. | ||
* | ||
* @param swap indicates if tag element will be swapped with length element | ||
* @return this, for chaining, not {@code null} | ||
*/ | ||
public CharTagMapBuilder withTagLengthSwap(boolean swap) { | ||
swapTagWithLength = swap; | ||
return this; | ||
} | ||
|
||
/** | ||
* Completes this builder by creating the {@code CharTagMap}. | ||
* | ||
|
@@ -71,6 +87,8 @@ public CharTagMap build() throws IllegalArgumentException { | |
if (lengthSize != null) | ||
tm.setLengthSize(lengthSize); | ||
|
||
tm.withTagLengthSwap(swapTagWithLength); | ||
|
||
return tm; | ||
} | ||
|
||
|
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