java.util.ResourceBundle.handleGetObject()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中java.util.ResourceBundle.handleGetObject方法的一些代码示例,展示了ResourceBundle.handleGetObject的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceBundle.handleGetObject方法的具体详情如下:
包路径:java.util.ResourceBundle
类名称:ResourceBundle
方法名:handleGetObject

ResourceBundle.handleGetObject介绍

[英]Returns the named resource from this ResourceBundle, or null if the resource is not found.
[中]返回此ResourceBundle中的命名资源,如果找不到该资源,则返回null。

代码示例

代码示例来源:origin: robovm/robovm

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: robovm/robovm

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: ibinti/bugvm

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: com.jtransc/jtransc-rt

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: com.bugvm/bugvm-rt

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: MobiVM/robovm

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: com.gluonhq/robovm-rt

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: FlexoVM/flexovm

protected Set<String> handleKeySet() {
  Set<String> set = keySet();
  Set<String> ret = new HashSet<String>();
  for (String key : set) {
    if (handleGetObject(key) != null) {
      ret.add(key);
    }
  }
  return ret;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Gets an object for the given key from this resource bundle or one of its parents.
 * This method first tries to obtain the object from this resource bundle using
 * {@link #handleGetObject(java.lang.String) handleGetObject}.
 * If not successful, and the parent resource bundle is not null,
 * it calls the parent's <code>getObject</code> method.
 * If still not successful, it throws a MissingResourceException.
 *
 * @param key the key for the desired object
 * @exception NullPointerException if <code>key</code> is <code>null</code>
 * @exception MissingResourceException if no object for the given key can be found
 * @return the object for the given key
 */
public final Object getObject(String key) {
  Object obj = handleGetObject(key);
  if (obj == null) {
    if (parent != null) {
      obj = parent.getObject(key);
    }
    if (obj == null)
      throw new MissingResourceException("Can't find resource for bundle "
                        +this.getClass().getName()
                        +", key "+key,
                        this.getClass().getName(),
                        key);
  }
  return obj;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Gets an object for the given key from this resource bundle or one of its parents.
 * This method first tries to obtain the object from this resource bundle using
 * {@link #handleGetObject(java.lang.String) handleGetObject}.
 * If not successful, and the parent resource bundle is not null,
 * it calls the parent's <code>getObject</code> method.
 * If still not successful, it throws a MissingResourceException.
 *
 * @param key the key for the desired object
 * @exception NullPointerException if <code>key</code> is <code>null</code>
 * @exception MissingResourceException if no object for the given key can be found
 * @return the object for the given key
 */
public final Object getObject(String key) {
  Object obj = handleGetObject(key);
  if (obj == null) {
    if (parent != null) {
      obj = parent.getObject(key);
    }
    if (obj == null)
      throw new MissingResourceException("Can't find resource for bundle "
                        +this.getClass().getName()
                        +", key "+key,
                        this.getClass().getName(),
                        key);
  }
  return obj;
}

代码示例来源:origin: jtulach/bck2brwsr

while (enumKeys.hasMoreElements()) {
  String key = enumKeys.nextElement();
  if (handleGetObject(key) != null) {
    keys.add(key);

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns the named resource from this {@code ResourceBundle}. If the resource
 * cannot be found in this bundle, it falls back to the parent bundle (if
 * it's not null) by calling the {@link #handleGetObject} method. If the resource still
 * can't be found it throws a {@code MissingResourceException}.
 *
 * @param key
 *            the name of the resource.
 * @return the resource object.
 * @throws MissingResourceException
 *                if the resource is not found.
 */
public final Object getObject(String key) {
  ResourceBundle last, theParent = this;
  do {
    Object result = theParent.handleGetObject(key);
    if (result != null) {
      return result;
    }
    last = theParent;
    theParent = theParent.parent;
  } while (theParent != null);
  throw missingResourceException(last.getClass().getName(), key);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

while (enumKeys.hasMoreElements()) {
  String key = enumKeys.nextElement();
  if (handleGetObject(key) != null) {
    keys.add(key);

相关文章