Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.labs64.utils.swid.support;
 
This generator always returns next sequence number as element identifier.
 
 public class SequentialIdGenerator implements IdGenerator {
 
    private long initialValue = 0;
    private long offset = 1;
    private String prefix;
    private String suffix;

    

Default ID generator constructor.

This constructor uses following default values:

initialValue = 0
offset = 1
prefix = null
suffix = null
    public SequentialIdGenerator() {
    }

    

Parameters:
initialValue initial value
offset offset
prefix identifier prefix
suffix identifier suffix
    public SequentialIdGenerator(final long initialValuefinal long offsetfinal String prefixfinal String suffix) {
        this. = initialValue;
        this. = offset;
        this. = prefix;
        this. = suffix;
    }
    @Override
    public String nextId() {
        StringBuilder sb = new StringBuilder();
        if (StringUtils.isNotBlank()) {
            sb.append();
            sb.append("_");
        }
         =  + ;
        sb.append();
        if (StringUtils.isNotBlank()) {
            sb.append("_");
            sb.append();
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X