Class ParseSeq

java.lang.Object
org.idempiere.util.ParseSeq
All Implemented Interfaces:
Iterable<Character>

public class ParseSeq extends Object implements Iterable<Character>
This class help to parse ordered configuration.
For example, problem in IDEMPIERE-2296. Some wish priority of "default value" is higher than "user value preference" and some other wish the reverse of that.
It is better to define 1 is representative for "default value" and 2 is representative for "user value preference", and in configuration just set 12 or 21 for an ordered configuration.

This class will help by providing method similar to Iterable and it also provide validation for duplicate value such as 221 or 211.

Author:
hieplq
  • Field Details

    • MSG_NOT_NULL

      public static String MSG_NOT_NULL
    • MSG_ONLY_NUNBER

      public static String MSG_ONLY_NUNBER
    • MSG_CONTAIN_DUP

      public static String MSG_CONTAIN_DUP
  • Method Details

    • parseValue

      protected void parseValue(String orderConfiguration, boolean allowDupCharacter, boolean onlyNumber)
      validate input string
      Parameters:
      orderConfiguration -
      allowDupCharacter -
      onlyNumber -
    • iterator

      public Iterator<Character> iterator()
      Specified by:
      iterator in interface Iterable<Character>
    • getNumberOrder

      public static ParseSeq getNumberOrder(String orderConfiguration)
      constructor maybe become complicate by add more validate (don't allow space, don't allow special,...) use get for simple when init this object, don't need add try catch block when use
      Parameters:
      orderConfiguration -
      Returns:
      null when input string isn't suitable
    • main

      public static void main(String[] args)
      run test for utility
      Parameters:
      args -
    • toString

      public String toString()
      Overrides:
      toString in class Object