本文整理了Java中org.apache.sis.util.logging.WarningListeners.getLocale()
方法的一些代码示例,展示了WarningListeners.getLocale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WarningListeners.getLocale()
方法的具体详情如下:
包路径:org.apache.sis.util.logging.WarningListeners
类名称:WarningListeners
方法名:getLocale
[英]The locale to use for formatting warning messages, or null for the default locale. If the source object given to the constructor implements the Localized interface, then this method delegates to its getLocale() method. Otherwise this method returns null.
[中]用于格式化警告消息的区域设置,默认区域设置为null。如果给定给构造函数的源对象实现了本地化接口,那么这个方法将委托给它的getLocale()方法。否则,该方法返回null。
代码示例来源:origin: org.apache.sis.storage/sis-storage
/**
* Returns the locale for error messages or warnings.
* Returns {@code null} if no locale is explicitly defined.
*
* @return the locale, or {@code null} if not explicitly defined.
*/
@Override
public final Locale getLocale() {
return (listeners != null) ? listeners.getLocale() : null;
}
代码示例来源:origin: apache/sis
/**
* Returns the locale for error messages or warnings.
* Returns {@code null} if no locale is explicitly defined.
*
* @return the locale, or {@code null} if not explicitly defined.
*/
@Override
public final Locale getLocale() {
return (listeners != null) ? listeners.getLocale() : null;
}
代码示例来源:origin: apache/sis
/**
* Returns the locale to use for warnings and error messages.
*/
final Locale getLocale() {
return listeners.getLocale();
}
代码示例来源:origin: apache/sis
/**
* Returns the resources to use for formatting error messages.
*/
private Errors errors() {
return Errors.getResources(listeners.getLocale());
}
}
代码示例来源:origin: org.apache.sis.storage/sis-netcdf
/**
* Returns the netCDF-specific resource bundle for the locale given by {@link WarningListeners#getLocale()}.
*
* @return the localized error resource bundle.
*/
final Resources resources() {
return Resources.forLocale(listeners.getLocale());
}
代码示例来源:origin: org.apache.sis.storage/sis-earth-observation
/**
* Returns the resources to use for formatting error messages.
*/
private Errors errors() {
return Errors.getResources(listeners.getLocale());
}
}
代码示例来源:origin: org.apache.sis.storage/sis-netcdf
/**
* Returns the localized error resource bundle for the locale given by {@link WarningListeners#getLocale()}.
*
* @return the localized error resource bundle.
*/
final Errors errors() {
return Errors.getResources(listeners.getLocale());
}
代码示例来源:origin: org.apache.sis.storage/sis-netcdf
/**
* Returns the localized error resource bundle for the locale given by
* {@link org.apache.sis.util.logging.WarningListeners#getLocale()}.
*
* @return the localized error resource bundle.
*/
private Errors errors() {
return Errors.getResources(decoder.listeners.getLocale());
}
代码示例来源:origin: apache/sis
/**
* Returns the localized error resource bundle for the locale given by {@link WarningListeners#getLocale()}.
*
* @return the localized error resource bundle.
*/
final Errors errors() {
return Errors.getResources(listeners.getLocale());
}
代码示例来源:origin: apache/sis
/**
* Returns the netCDF-specific resource bundle for the locale given by {@link WarningListeners#getLocale()}.
*
* @return the localized error resource bundle.
*/
final Resources resources() {
return Resources.forLocale(listeners.getLocale());
}
代码示例来源:origin: org.apache.sis.storage/sis-netcdf
/**
* Returns an exception for a malformed header. This is used only after we have determined
* that the file should be a netCDF one, but we found some inconsistency or unknown tags.
*/
private DataStoreException malformedHeader() {
return new DataStoreContentException(listeners.getLocale(), "netCDF", getFilename(), null);
}
代码示例来源:origin: org.apache.sis.storage/sis-earth-observation
/**
* Returns the filename to show in error messages, or a localized "unnamed" word if none.
*/
private String getFilename() {
return (filename != null) ? filename : Vocabulary.getResources(listeners.getLocale()).getString(Vocabulary.Keys.Unnamed);
}
代码示例来源:origin: apache/sis
/**
* Reports a warning to the listeners specified at construction time.
*
* @param caller the caller class to report, preferably a public class.
* @param method the caller method to report, preferable a public method.
* @param exception the exception that occurred, or {@code null} if none.
* @param key one or {@link Errors.Keys} constants.
* @param arguments values to be formatted in the {@link java.text.MessageFormat} pattern.
*/
protected final void error(final Class<?> caller, final String method, final Exception exception, final short key, final Object... arguments) {
warning(listeners, caller, method, exception, Errors.getResources(listeners.getLocale()), key, arguments);
}
代码示例来源:origin: apache/sis
/**
* Returns the filename to show in error messages, or a localized "unnamed" word if none.
*/
private String getFilename() {
return (filename != null) ? filename : Vocabulary.getResources(listeners.getLocale()).getString(Vocabulary.Keys.Unnamed);
}
代码示例来源:origin: apache/sis
/**
* Returns an exception for a malformed header. This is used only after we have determined
* that the file should be a netCDF one, but we found some inconsistency or unknown tags.
*/
private DataStoreContentException malformedHeader() {
return new DataStoreContentException(listeners.getLocale(), FORMAT_NAME, getFilename(), null);
}
代码示例来源:origin: apache/sis
/**
* Reports a warning to the specified listeners.
*
* @param listeners the listeners where to report the warning.
* @param caller the caller class to report, preferably a public class.
* @param method the caller method to report, preferable a public method.
* @param exception the exception that occurred, or {@code null} if none.
* @param resources the resources bundle for {@code key} and {@code arguments}, or {@code null} for {@link Resources}.
* @param key one or {@link Resources.Keys} constants.
* @param arguments values to be formatted in the {@link java.text.MessageFormat} pattern.
*/
static void warning(final WarningListeners<?> listeners, final Class<?> caller, final String method,
final Exception exception, IndexedResourceBundle resources, final short key, final Object... arguments)
{
if (resources == null) {
resources = Resources.forLocale(listeners.getLocale());
}
final LogRecord record = resources.getLogRecord(Level.WARNING, key, arguments);
record.setLoggerName(Modules.NETCDF);
record.setSourceClassName(caller.getCanonicalName());
record.setSourceMethodName(method);
if (exception != null) {
// TODO: avoid reporting the full exception stack trace (maybe leverage QuietLogRecord).
record.setThrown(exception);
}
listeners.warning(record);
}
代码示例来源:origin: apache/sis
/**
* Logs a warning using the localized error resource bundle for the locale given by
* {@link WarningListeners#getLocale()}.
*
* @param key one of {@link Errors.Keys} values.
*/
private void warning(final short key, final Object p1, final Object p2, final Exception e) {
final WarningListeners<DataStore> listeners = decoder.listeners;
listeners.warning(Errors.getResources(listeners.getLocale()).getString(key, p1, p2), e);
}
代码示例来源:origin: apache/sis
if (exception != null) {
trace = exception.getStackTrace();
message = Exceptions.formatChainedMessages(getLocale(), message, exception);
if (message == null) {
message = exception.toString();
代码示例来源:origin: org.apache.sis.storage/sis-netcdf
/**
* If this decoder can handle the file content as features, returns handlers for them.
*
* @return {@inheritDoc}
* @throws IOException if an I/O operation was necessary but failed.
* @throws DataStoreException if the library of geometric objects is not available.
*/
@Override
@SuppressWarnings("null")
public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException {
if (features == null && file instanceof NetcdfDataset) {
features = FeatureDatasetFactoryManager.wrap(null, (NetcdfDataset) file, this,
new Formatter(new LogAdapter(listeners), listeners.getLocale()));
}
List<FeatureCollection> fc = null;
if (features instanceof FeatureDatasetPoint) {
fc = ((FeatureDatasetPoint) features).getPointFeatureCollectionList();
}
final FeaturesWrapper[] wrappers = new FeaturesWrapper[(fc != null) ? fc.size() : 0];
try {
for (int i=0; i<wrappers.length; i++) {
wrappers[i] = new FeaturesWrapper(fc.get(i), geomlib, listeners);
}
} catch (IllegalArgumentException e) {
throw new DataStoreException(e.getLocalizedMessage(), e);
}
return wrappers;
}
代码示例来源:origin: apache/sis
/**
* If this decoder can handle the file content as features, returns handlers for them.
*
* @return {@inheritDoc}
* @throws IOException if an I/O operation was necessary but failed.
* @throws DataStoreException if the library of geometric objects is not available.
*/
@Override
@SuppressWarnings("null")
public DiscreteSampling[] getDiscreteSampling() throws IOException, DataStoreException {
if (features == null && file instanceof NetcdfDataset) {
features = FeatureDatasetFactoryManager.wrap(null, (NetcdfDataset) file, this,
new Formatter(new LogAdapter(listeners), listeners.getLocale()));
}
List<FeatureCollection> fc = null;
if (features instanceof FeatureDatasetPoint) {
fc = ((FeatureDatasetPoint) features).getPointFeatureCollectionList();
}
final FeaturesWrapper[] wrappers = new FeaturesWrapper[(fc != null) ? fc.size() : 0];
try {
for (int i=0; i<wrappers.length; i++) {
wrappers[i] = new FeaturesWrapper(fc.get(i), geomlib, listeners);
}
} catch (IllegalArgumentException e) {
throw new DataStoreException(e.getLocalizedMessage(), e);
}
return wrappers;
}
内容来源于网络,如有侵权,请联系作者删除!