List of usage examples for java.text MessageFormat format
public static String format(String pattern, Object... arguments)
From source file:fr.inria.atlanmod.mogwai.util.MogwaiURI.java
public static URI createMogwaiURI(URI uri) { if (NeoURI.FILE_SCHEME.equals(uri.scheme())) { return createMogwaiURI(FileUtils.getFile(uri.toFileString())); } else if (MOGWAI_SCHEME.equals(uri.scheme())) { return NeoURI.createNeoURI(uri); } else {/*from w w w. java 2s . c o m*/ throw new IllegalArgumentException( MessageFormat.format("Can not create NeoGraphURI from the URI scheme {0}", uri.scheme())); } }
From source file:fr.inria.atlanmod.neoemf.map.util.NeoMapURI.java
public static URI createNeoMapURI(URI uri) { if (NeoURI.FILE_SCHEME.equals(uri.scheme())) { return createNeoMapURI(FileUtils.getFile(uri.toFileString())); } else if (NEO_MAP_SCHEME.equals(uri.scheme())) { return NeoURI.createNeoURI(uri); } else {/* w ww.j av a2 s. c om*/ throw new IllegalArgumentException( MessageFormat.format("Can not create NeoMapURI from the URI scheme {0}", uri.scheme())); } }
From source file:com.asakusafw.runtime.stage.launcher.Util.java
static void closeQuiet(Object object) { if (object instanceof Closeable) { try {/*from w w w . j a va 2 s . c om*/ ((Closeable) object).close(); } catch (IOException e) { LOG.warn(MessageFormat.format("Exception occurred while closing: {0}", object), e); } } }
From source file:fr.inria.atlanmod.neoemf.graph.blueprints.util.NeoBlueprintsURI.java
public static URI createNeoGraphURI(URI uri) { if (NeoURI.FILE_SCHEME.equals(uri.scheme())) { return createNeoGraphURI(FileUtils.getFile(uri.toFileString())); } else if (NEO_GRAPH_SCHEME.equals(uri.scheme())) { return NeoURI.createNeoURI(uri); } else {// ww w .j a v a2 s . c om throw new IllegalArgumentException( MessageFormat.format("Can not create NeoGraphURI from the URI scheme {0}", uri.scheme())); } }
From source file:com.microsoft.tfs.jni.KeychainEnum.java
protected static int computeValue(final String fourCharCode) { Check.notNull(fourCharCode, "fourCharCode"); //$NON-NLS-1$ Check.isTrue(fourCharCode.length() == 4, "fourCharCode.length == 4"); //$NON-NLS-1$ byte[] charValues = new byte[] { 0, 0, 0, 0 }; try {/* www . jav a 2s . c o m*/ charValues = fourCharCode.getBytes("US-ASCII"); //$NON-NLS-1$ } catch (final UnsupportedEncodingException e) { log.warn(MessageFormat.format("Could not get ascii representation of FourCharCode: {0}", fourCharCode), //$NON-NLS-1$ e); } return (charValues[0] << 24) | (charValues[1] << 16) | (charValues[2] << 8) | (charValues[3]); }
From source file:cz.muni.fi.editor.services.commons.Assert.java
public static void fieldIsEmpty(String fieldValue, String fieldName) throws FieldException { if (StringUtils.isEmpty(fieldValue)) { throw new FieldException(fieldName, MessageFormat.format("Field {0} is empty.", fieldName)); }/*w ww. j a va 2s. c om*/ }
From source file:com.microsoft.tfs.client.common.framework.command.helpers.CommandHelpers.java
/** * Gets the type of the underlying command class. * * Note that we occasionally wrap commands inside other commands in order to * provide additional functionality. See, for example, * ThreadedCancellableCommand. We want to report the ultimate cause of this * error, so we dig until we locate the source. Limit to a suitable * iteration depth to avoid infinite recursion. * * @param command/* www . ja va 2s. co m*/ * The command being executed (not <code>null</code>) * @return the underlying (unwrapped) command */ public static ICommand unwrapCommand(ICommand command) { for (int i = 0; i < MAX_RECURSION_DEPTH && command instanceof CommandWrapper; i++) { final ICommand wrappedCommand = ((CommandWrapper) command).getWrappedCommand(); if (wrappedCommand == null) { log.error(MessageFormat.format("Command {0} wraps null command", //$NON-NLS-1$ command.getClass().getCanonicalName())); break; } command = wrappedCommand; } return command; }
From source file:de.onyxbits.raccoon.cli.Router.java
/** * Print an error message and exit/*w ww . j a v a 2 s .co m*/ * * @param reason * property (minus the "fail." prefix) that contains the error * message. * @param args * format option. */ public static void fail(String reason, Object... args) { System.err.println(MessageFormat.format(Messages.getString("fail." + reason), args)); System.exit(1); }
From source file:com.bah.lucene.buffer.BufferStore.java
public static void init(int _1KSize, int _8KSize) { if (!setup) { LOG.info(MessageFormat.format("Initializing the 1024 buffers with [{0}] buffers.", _1KSize)); _1024 = setupBuffers(1024, _1KSize); LOG.info(MessageFormat.format("Initializing the 8192 buffers with [{0}] buffers.", _8KSize)); _8192 = setupBuffers(8192, _8KSize); setup = true;//from w ww . j av a 2 s. co m } }
From source file:com.jidesoft.spring.richclient.docking.LayoutManager.java
public static boolean isValidLayout(DockingManager manager, String pageId, Perspective perspective) { String pageLayout = MessageFormat.format(PAGE_LAYOUT, new Object[] { pageId, perspective.getId() }); return manager.isLayoutAvailable(pageLayout) && manager.isLayoutDataVersionValid(pageLayout); }