List of usage examples for java.text MessageFormat MessageFormat
public MessageFormat(String pattern)
From source file:enumsupport.reverselookupmapfactory.DeduplicatdeNumberSetFactory.java
/** * * @param numberRange ???//from w w w. j a v a 2 s . c o m * @param number null?? * @param numbers ??????null?????? * @return ????(??) * @throws NullPointerException ?????null????? * @throws IllegalArgumentException ??numberrange??????? */ public Set<T> makeSet(Range<T> numberRange, T number, T... numbers) throws NullPointerException, IllegalArgumentException { List<T> t = new ArrayList<>(); t.add(number); if (numbers != null) { t.addAll(Arrays.asList(numbers)); } for (T num : t) { if (num == null) { throw new IllegalArgumentException("?null???????"); } if (!numberRange.contains(num)) { MessageFormat msg = new MessageFormat( "????????????={0}"); Object[] parameters = { num }; throw new IllegalArgumentException(msg.format(parameters)); } } Set<T> numberSet_t = Collections.synchronizedSet(new HashSet<>()); numberSet_t.addAll(t); return Collections.unmodifiableSet(numberSet_t); }
From source file:com.haulmont.timesheets.entity.ExtUser.java
@Override public String getCaption() { if (StringUtils.isNotEmpty(firstName) || StringUtils.isNotEmpty(lastName)) { String pattern = "{0} {1}"; MessageFormat fmt = new MessageFormat(pattern); return StringUtils.trimToEmpty(fmt.format( new Object[] { StringUtils.trimToEmpty(firstName), StringUtils.trimToEmpty(lastName) })); }// w w w . j a v a 2s.co m return super.getCaption(); }
From source file:TimeMeasure.java
/** * Simple TimeMesaure with default format. */ public TimeMeasure() { this(new MessageFormat("{0}\t: {1}\t {2}x\n")); }
From source file:descriptordump.dumpexecutor.AbstractExecutor.java
public final void process(Section section) { if (!this.tids.contains(section.getTable_id_const())) { MessageFormat msg = new MessageFormat( "?ID???????????ID={0}"); Object[] parameters = { Integer.toHexString(section.getTable_id()) }; LOG.error(msg.format(parameters)); } else {//from ww w.j a va2s . c o m this._process(this.getDest(), section); } }
From source file:playmidi.task.MidiPlayTask.java
public MidiPlayTask(File midiFile, int count) throws FileNotFoundException, IOException, MidiUnavailableException, InvalidMidiDataException { this.midiFile = midiFile; this.loopCount = count; if (this.midiFile == null) { throw new NullPointerException("??????"); }/*ww w .ja v a 2 s . com*/ if (!midiFile.exists()) { MessageFormat msg1 = new MessageFormat("?????File={0}"); Object[] parameters1 = { this.midiFile.getAbsolutePath() }; throw new FileNotFoundException(msg1.format(parameters1)); } if (!midiFile.isFile()) { MessageFormat msg1 = new MessageFormat("?????File={0}"); Object[] parameters1 = { this.midiFile.getAbsolutePath() }; throw new IllegalArgumentException(msg1.format(parameters1)); } if (!midiFile.canRead()) { MessageFormat msg1 = new MessageFormat("?????File={0}"); Object[] parameters1 = { this.midiFile.getAbsolutePath() }; throw new IllegalArgumentException(msg1.format(parameters1)); } MessageFormat msg1 = new MessageFormat("File={0},LoopCount={1}"); Object[] parameters1 = { this.midiFile.getAbsolutePath(), loopCount }; LOG.info(msg1.format(parameters1)); LOG.trace("?"); sequencer = MidiSystem.getSequencer(); sequencer.setLoopEndPoint(-1L); sequencer.setLoopCount(loopCount); sequencer.open(); LOG.trace("?"); LOG.trace("??"); try (FileInputStream in = new FileInputStream(this.midiFile)) { Sequence sequence = MidiSystem.getSequence(in); sequencer.setLoopCount(count); sequencer.setSequence(sequence); } LOG.trace("??"); }
From source file:org.squale.squalecommon.util.messages.CommonMessages.java
/** * Obtention d'un message variable/*from ww w . j a v a2s . co m*/ * * @param pKey clef * @param pObjects objets * @return chane rsultante */ public static String getString(String pKey, Object[] pObjects) { MessageFormat format = new MessageFormat(getString(pKey)); return format.format(pObjects); }
From source file:com.edgenius.wiki.render.filter.HeadingFilter.java
public void init() { regexProvider.compile(getRegex(), Pattern.MULTILINE); formatter = new MessageFormat(""); formatter.applyPattern(getReplacement()); }
From source file:classes.SharedClass.java
public static void print(String message, JTable table) { MessageFormat header = new MessageFormat(message); MessageFormat footer = new MessageFormat("(0,number,nteger)"); try {/* w ww . j a va 2s .co m*/ boolean result = table.print(JTable.PrintMode.FIT_WIDTH, header, footer); if (result) { JOptionPane.showMessageDialog(null, " "); } } catch (PrinterException ex) { Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.contextfw.web.application.component.Script.java
public void build(DOMBuilder b, Gson gson, ScriptContext scriptContext) { Object[] arguments = getArguments(scriptContext); if (arguments == null) { b.text(getScript(scriptContext)); } else {/*w w w . ja va2 s. c o m*/ MessageFormat format = new MessageFormat(getScript(scriptContext)); b.text(format.format(getStringParams(gson, arguments))); } }
From source file:org.web4thejob.security.ADAuthenticationProvider.java
private String getPrincipal(String uname) { MessageFormat mf = new MessageFormat(pattern); return mf.format(new String[] { uname }); }