rest bundle

GitOrigin-RevId: 1e2017f3b1e6ca2e8320eec404797955627ea5ce
This commit is contained in:
Sergey Ignatov
2019-12-19 22:06:01 +00:00
committed by intellij-monorepo-bot
parent 4235731d82
commit ef0bfae0bf
@@ -15,40 +15,19 @@
*/
package com.jetbrains.rest;
import com.intellij.CommonBundle;
import com.intellij.reference.SoftReference;
import com.intellij.DynamicBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
import java.lang.ref.Reference;
import java.util.ResourceBundle;
public class RestBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "com.jetbrains.rest.RestBundle";
private static final RestBundle INSTANCE = new RestBundle();
// A copy of Ruby's.
/**
* User : catherine
*/
public class RestBundle {
private RestBundle() { super(BUNDLE); }
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
return INSTANCE.getMessage(key, params);
}
private static Reference<ResourceBundle> ourBundle;
@NonNls
private static final String BUNDLE = "com.jetbrains.rest.RestBundle";
private RestBundle() {
}
// Cached loading
private static ResourceBundle getBundle() {
ResourceBundle bundle = SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
}
}
}