Terms of Service | Privacy Policy | Cookie Policy

Skip to content
Commits on Source (3)
......@@ -17,6 +17,16 @@ build:
script:
- mvn $MAVEN_CLI_OPTS clean package
deploy:
stage: deploy
only:
refs:
- master@sw4j-org/random-barcode
variables:
- $REPO_USER
script:
- mvn $MAVEN_CLI_OPTS deploy
pages:
stage: deploy
only:
......
......@@ -2,8 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sw4j.tool.barcode</groupId>
<artifactId>random</artifactId>
<groupId>org.sw4j.tool</groupId>
<artifactId>random-barcode</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
......
......@@ -138,9 +138,9 @@ public class CodeGenerator {
Set<String> inputValues = new LinkedHashSet<>();
while (mappingIterator.hasNext()) {
Identifier ident = mappingIterator.next();
if (!inputValues.add(ident.getValue())) {
if (!inputValues.add(ident.getIdent())) {
throw new IllegalArgumentException(
String.format("Duplicated input value '%s' found", ident.getValue()));
String.format("Duplicated input value '%s' found", ident.getIdent()));
}
}
final Set<RandomIdent> randomValues = createCodes(inputValues, encodings);
......
......@@ -16,43 +16,46 @@
*/
package org.sw4j.tool.barcode.random.input;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
*
* @author uwe
* <p>
* This class maps the input identifiers to Java objects.
* </p>
* <p>
* This class is immutable.
* </p>
* @author Uwe Plonus &lt;u.plonus@gmail.com&gt;
*/
public class Identifier {
@JsonProperty
private String value;
public String getValue() {
return value;
}
/**
* <p>
* The identifier value itself.
* </p>
*/
private final String ident;
@Override
public int hashCode() {
return value.hashCode();
/**
* <p>
* Create a new {@code Identifier} with the given {@code ident}.
* </p>
* @param ident the identifiers value.
*/
@JsonCreator
public Identifier(@JsonProperty("ident") final String ident) {
this.ident = ident;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Identifier other = (Identifier) obj;
if (!Objects.equals(this.value, other.value)) {
return false;
}
return true;
/**
* <p>
* The identifiers value.
* </p>
* @return the value.
*/
public String getIdent() {
return ident;
}
}
/*
* Copyright (C) 2019 sw4j.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* <p>
* This package contains the input mapping.
* </p>
*/
package org.sw4j.tool.barcode.random.input;