001package org.unix4j.codegen.optset; 002 003import java.util.Arrays; 004import java.util.Collection; 005 006import org.unix4j.codegen.command.def.OptionDef; 007 008public class OptionHelper { 009 010 public String getNameWithOptionPostfix(String name, Collection<OptionDef> options) { 011 if (options.isEmpty()) return name; 012 return name + "_" + allOptionAcronyms(options); 013 } 014 public String allOptionAcronyms(Collection<OptionDef> options) { 015 final char[] acronyms = new char[options.size()]; 016 int index = 0; 017 for (final OptionDef opt : options) { 018 acronyms[index] = opt.acronym.charAt(0); 019 index++; 020 } 021 Arrays.sort(acronyms); 022 return String.valueOf(acronyms); 023 } 024}