当前位置: 首页>>代码示例>>Java>>正文


Java ListResourceBundle类代码示例

本文整理汇总了Java中java.util.ListResourceBundle的典型用法代码示例。如果您正苦于以下问题:Java ListResourceBundle类的具体用法?Java ListResourceBundle怎么用?Java ListResourceBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ListResourceBundle类属于java.util包,在下文中一共展示了ListResourceBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getResourceBundle

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * Gets a resource bundle using the specified base name and locale, and the caller's class loader.
 * @param bundle the base name of the resource bundle, a fully qualified class name
 * @param locale the locale for which a resource bundle is desired
 * @return a resource bundle for the given base name and locale
 */
public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
    return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
        public ListResourceBundle run() {
            try {
                return (ListResourceBundle)ResourceBundle.getBundle(bundle, locale);
            } catch (MissingResourceException e) {
                try {
                    return (ListResourceBundle)ResourceBundle.getBundle(bundle, new Locale("en", "US"));
                } catch (MissingResourceException e2) {
                    throw new MissingResourceException(
                            "Could not load any resource bundle by " + bundle, bundle, "");
                }
            }
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:SecuritySupport.java

示例2: getResourceBundle

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * Gets a resource bundle using the specified base name and locale, and the
 * caller's class loader.
 *
 * @param bundle the base name of the resource bundle, a fully qualified
 * class name
 * @param locale the locale for which a resource bundle is desired
 * @return a resource bundle for the given base name and locale
 */
public static ListResourceBundle getResourceBundle(final String bundle, final Locale locale) {
    return AccessController.doPrivileged(new PrivilegedAction<ListResourceBundle>() {
        public ListResourceBundle run() {
            try {
                return (ListResourceBundle) ResourceBundle.getBundle(bundle, locale);
            } catch (MissingResourceException e) {
                try {
                    return (ListResourceBundle) ResourceBundle.getBundle(bundle, new Locale("en", "US"));
                } catch (MissingResourceException e2) {
                    throw new MissingResourceException(
                            "Could not load any resource bundle by " + bundle, bundle, "");
                }
            }
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SecuritySupport.java

示例3: loadClass

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * Loads a resources using JRE and returns the names
 */
private static Set<String> loadClass(String clazz) throws Exception {
    ListResourceBundle lrb =
            (ListResourceBundle)Class.forName(clazz).newInstance();
    Set<String> keys = lrb.keySet();
    Map<String,String> newold = new HashMap<String,String>();
    boolean dup = false;
    // Check if normalize() creates dup entries. This is crucial.
    for (String k: keys) {
        String key = normalize(k);
        if (newold.containsKey(key)) {
            err("Dup found for " + key + ":");
            err("["+newold.get(key)+"]");
            err("["+k+"]");
            dup = true;
        }
        newold.put(key, k);
    }
    if (dup) throw new Exception();
    return keys;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:NewResourcesNames.java

示例4: AbstractConverter

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * @deprecated Construtor para AbstractConverter contendo os formatadores de
 *             convers�o padr�o<br>
 *             � altamente recomend�vel que se construa este objeto
 *             informando o resourceBundle de internacionalizacao
 */
public AbstractConverter() {
	logger
			.warn("ATENCAO!! CONSTRUINDO UM RESOURCE BUNDLE COM A INTERNACIONALIZA��O DE "
					+ "FORMATOS PADR�O!!!. ISTO PODE COMPROMETER A PORTABILIDADE DA APLICACAO");

	ResourceBundle resourceBundle = new ListResourceBundle() {
		protected Object[][] getContents() {
			String valores[][] = {
					{ PROPERTY_FORMATO_DATA_VIEW, DEFAULT_FORMATO_DATA },
					{ PROPERTY_DECIMAL_SEPARATOR, DEFAULT_DECIMAL_SEPARATOR },
					{ PROPERTY_GROUPING_SEPARATOR,
							DEFAULT_GROUPING_SEPARATOR },
					{ PROPERTY_FORMATO_SHORT, DEFAULT_FORMATO_SHORT },
					{ PROPERTY_FORMATO_INTEGER, DEFAULT_FORMATO_INTEGER },
					{ PROPERTY_FORMATO_LONG, DEFAULT_FORMATO_LONG },
					{ PROPERTY_FORMATO_FLOAT, DEFAULT_FORMATO_FLOAT },
					{ PROPERTY_FORMATO_DOUBLE, DEFAULT_FORMATO_DOUBLE } };
			return valores;
		}
	};

	setResourceBundle(resourceBundle);
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:30,代码来源:AbstractConverter.java

示例5: getResourceBundle

import java.util.ListResourceBundle; //导入依赖的package包/类
@POST
@Path( "/wildcard" )
public ResourceBundle getResourceBundle( ResourceBundleRequest resourceBundleRequest ) {
  final List<ResourceBundle> resourceBundles = new ArrayList<ResourceBundle>(  );
  for ( ResourceBundleWildcard resourceBundleWildcard : resourceBundleRequest.getWildcards() ) {
    Pattern keyPattern = Pattern.compile( resourceBundleWildcard.getKeyRegex() );
    resourceBundles.addAll( getResourceBundles( keyPattern, getLocale( resourceBundleRequest.getLocale() ) ) );
  }
  return new ListResourceBundle() {
    @Override protected Object[][] getContents() {
      List<Object[]> entries = new ArrayList<Object[]>();
      for ( ResourceBundle resourceBundle : resourceBundles ) {
        for ( String key : Collections.list( resourceBundle.getKeys() ) ) {
          entries.add( new Object[] { key, resourceBundle.getString( key ) } );
        }
      }
      return entries.toArray( new Object[ entries.size() ][] );
    }
  };
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:21,代码来源:LocalizationWebservice.java

示例6: onCreateActions

import java.util.ListResourceBundle; //导入依赖的package包/类
@Override
public void onCreateActions(ListResourceBundle resources, final BaseEditor baseEditor, IProgressMonitor monitor) {
    PyEdit edit = (PyEdit) baseEditor;
    edit.addOfflineActionListener("--internal-test-modules", new Action() {
        @Override
        public void run() {
            List<IPythonNature> allPythonNatures = PythonNature.getAllPythonNatures();
            StringBuffer buf = new StringBuffer();
            try {
                for (IPythonNature nature : allPythonNatures) {
                    buf.append(checkIntegrity(nature, new NullProgressMonitor(), true));
                }
            } catch (MisconfigurationException e) {
                buf.append(e.getMessage());
            }
            UIUtils.showString(buf.toString());
        }
    }, "Used just for testing (do not use).", true);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:AdditionalInfoIntegrityChecker.java

示例7: notifyOnCreateActions

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * Notifies listeners that the actions have just been created in the editor.
 */
public void notifyOnCreateActions(final ListResourceBundle resources) {
    final BaseEditor edit = pyEdit.get();
    if (edit == null) {
        return;
    }
    INotifierRunnable runnable = new INotifierRunnable() {
        @Override
        public void run(final IProgressMonitor monitor) {
            for (IPyEditListener listener : edit.getAllListeners()) {
                try {
                    if (!monitor.isCanceled()) {
                        listener.onCreateActions(resources, edit, monitor);
                    }
                } catch (Exception e) {
                    //must not fail
                    Log.log(e);
                }
            }
        }
    };
    runIt(runnable);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:PyEditNotifier.java

示例8: onCreateActions

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * This method associates Ctrl+new line with the evaluation of commands in the console.
 */
@Override
public void onCreateActions(ListResourceBundle resources, final BaseEditor baseEditor, IProgressMonitor monitor) {
    final PyEdit edit = (PyEdit) baseEditor;
    final EvaluateAction evaluateAction = new EvaluateAction(edit);
    evaluateAction.setActionDefinitionId(IInteractiveConsoleConstants.EVALUATE_ACTION_ID);
    evaluateAction.setId(IInteractiveConsoleConstants.EVALUATE_ACTION_ID);
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            if (!edit.isDisposed()) {
                edit.setAction(IInteractiveConsoleConstants.EVALUATE_ACTION_ID, evaluateAction);
            }
        }
    };
    Display.getDefault().syncExec(runnable);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:EvaluateActionSetter.java

示例9: onCreateActions

import java.util.ListResourceBundle; //导入依赖的package包/类
@Override
public void onCreateActions(ListResourceBundle resources, BaseEditor baseEditor, IProgressMonitor monitor) {
    //Note: can be called multiple times (will only create handlers for the new actions).
    Map<String, InteractiveCommandCustomHandler> commandIdToHandler = InteractiveConsoleCommand
            .getCommandIdToHandler();
    Set<Entry<String, InteractiveCommandCustomHandler>> entrySet = commandIdToHandler.entrySet();
    for (Entry<String, InteractiveCommandCustomHandler> entry : entrySet) {
        if (idToAction.containsKey(entry.getKey())) {
            continue;
        }
        InteractiveConsoleUserCommandAction action = new InteractiveConsoleUserCommandAction(resources,
                "Pyedit.InteractiveConsoleUserCommand", baseEditor, entry.getKey());
        action.setActionDefinitionId(entry.getKey());
        action.setId(entry.getKey());
        baseEditor.setAction(FullRepIterable.getLastPart(entry.getKey()), action);
        idToAction.put(entry.getKey(), action);
    }
    this.resources = resources;
    this.weakEditor = new WeakReference<>(baseEditor);
    InteractiveConsoleCommand.onCommandIdToHandlerChanged.registerListener(onCommandIdToHandlerChangedCallback);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:22,代码来源:InteractiveConsoleCommandsSyncListener.java

示例10: setUp

import java.util.ListResourceBundle; //导入依赖的package包/类
@Before
public void setUp() {
	request = mock(HttpServletRequest.class);
	servletContext = mock(ServletContext.class);
	session = mock(HttpSession.class);

	localization = new JstlLocalization(request);

	ResourceBundle bundle = new ListResourceBundle() {
		@Override
		protected Object[][] getContents() {
			return new Object[][] { { "my.key", "abc" } };
		}
	};

	LocalizationContext context = new LocalizationContext(bundle);
	when(request.getAttribute(FMT_LOCALIZATION_CONTEXT + ".request")).thenReturn(context);

	when(request.getSession(false)).thenReturn(session);
	when(request.getServletContext()).thenReturn(servletContext);
}
 
开发者ID:caelum,项目名称:vraptor4,代码行数:22,代码来源:JstlLocalizationTest.java

示例11: call

import java.util.ListResourceBundle; //导入依赖的package包/类
public Object call() throws Exception {
    LogRecord lg = new LogRecord(Level.ALL, getMessage());
    lg.setResourceBundle(new ListResourceBundle() {
        protected Object[][] getContents() {
            return new Object[][] { {getMessage(), getMessage()} };
        }
    });
    return new LogRecord[] { lg };
}
 
开发者ID:wordin0,项目名称:javacv,代码行数:10,代码来源:BaseChildSettings.java

示例12: AbstractConverter

import java.util.ListResourceBundle; //导入依赖的package包/类
/**
 * @deprecated Construtor para AbstractConverter contendo os formatadores de conversao padrAo<br>
 *             e altamente recomendAvel que se construa este objeto informando o resourceBundle de internacionalizacao
 */
public AbstractConverter() {
	logger.warn("ATENCAO!! CONSTRUINDO UM RESOURCE BUNDLE COM A INTERNACIONALIZAcao DE " + "FORMATOS PADRAO!!!. ISTO PODE COMPROMETER A PORTABILIDADE DA APLICACAO");

	ResourceBundle resourceBundle = new ListResourceBundle() {
		protected Object[][] getContents() {
			String valores[][] = { { PROPERTY_FORMATO_DATA_VIEW, DEFAULT_FORMATO_DATA }, { PROPERTY_DECIMAL_SEPARATOR, DEFAULT_DECIMAL_SEPARATOR }, { PROPERTY_GROUPING_SEPARATOR, DEFAULT_GROUPING_SEPARATOR }, { PROPERTY_FORMATO_SHORT, DEFAULT_FORMATO_SHORT }, { PROPERTY_FORMATO_INTEGER, DEFAULT_FORMATO_INTEGER }, { PROPERTY_FORMATO_LONG, DEFAULT_FORMATO_LONG },
					{ PROPERTY_FORMATO_FLOAT, DEFAULT_FORMATO_FLOAT }, { PROPERTY_FORMATO_DOUBLE, DEFAULT_FORMATO_DOUBLE } };
			return valores;
		}
	};

	setResourceBundle(resourceBundle);
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:18,代码来源:AbstractConverter.java

示例13: getDefaultBuildInfo

import java.util.ListResourceBundle; //导入依赖的package包/类
private static BuildInfo getDefaultBuildInfo() {
  return new BuildInfo(
    new ListResourceBundle() {
      @Override
      public Object[][] getContents() {
        return new Object[][] {
            { "svnVersion", "345M", },
            { "timestamp", "January 1, 2007", },
        };
      }
    });
}
 
开发者ID:google,项目名称:caja,代码行数:13,代码来源:BuildInfoTest.java

示例14: testConvertResourceBundle_add2558

import java.util.ListResourceBundle; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testConvertResourceBundle_add2558() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testConvertResourceBundle_add2558");
    final Map<java.lang.String, java.lang.String> in = new HashMap<java.lang.String, java.lang.String>(5 , 1);
    in.put("1", "A");
    in.put("1", "A");
    in.put("2", "B");
    in.put("3", "C");
    in.put("4", "D");
    in.put("5", "E");
    final ResourceBundle b = new ListResourceBundle() {
        @Override
        public Object[][] getContents() {
            final Object[][] contents = new Object[in.size()][2];
            final Iterator<java.lang.String> i = in.keySet().iterator();
            int n = 0;
            while (i.hasNext()) {
                final Object key = i.next();
                final Object val = in.get(key);
                contents[n][0] = key;
                contents[n][1] = val;
                ++n;
            }
            return contents;
        }
    };
    final Map<java.lang.String, java.lang.Object> out = org.apache.commons.collections4.MapUtils.toMap(b);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7777,in,7776,in.equals(out));
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:31,代码来源:MapUtilsTest.java

示例15: testConvertResourceBundle_add2559

import java.util.ListResourceBundle; //导入依赖的package包/类
@org.junit.Test(timeout = 1000)
public void testConvertResourceBundle_add2559() {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testConvertResourceBundle_add2559");
    final Map<java.lang.String, java.lang.String> in = new HashMap<java.lang.String, java.lang.String>(5 , 1);
    in.put("1", "A");
    in.put("2", "B");
    in.put("2", "B");
    in.put("3", "C");
    in.put("4", "D");
    in.put("5", "E");
    final ResourceBundle b = new ListResourceBundle() {
        @Override
        public Object[][] getContents() {
            final Object[][] contents = new Object[in.size()][2];
            final Iterator<java.lang.String> i = in.keySet().iterator();
            int n = 0;
            while (i.hasNext()) {
                final Object key = i.next();
                final Object val = in.get(key);
                contents[n][0] = key;
                contents[n][1] = val;
                ++n;
            }
            return contents;
        }
    };
    final Map<java.lang.String, java.lang.Object> out = org.apache.commons.collections4.MapUtils.toMap(b);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),7777,in,7776,in.equals(out));
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:31,代码来源:MapUtilsTest.java


注:本文中的java.util.ListResourceBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。