⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resource.java

📁 jxta_src_2.41b jxta 2.41b 最新版源码 from www.jxta.org
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * @param       key     specified resource name     * @return              resource value as a float     * @throws      {@link net.jxta.ext.config.ConverstionException}    thrown in the event the named     *                                              resource is not convertible to     *                                              a float or is not resolvable.     */        public float getFloat(String key)    throws ConversionException {        return getFloat(key, null);    }    /**     * Accessor for the named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource value as a float or the specified default     *                      value if the named resource is not covertible to a     *                      float or is not resovlable.     */    public float getFloat(String key, float d) {        float f = 0;        try {            f = getFloat(key, new Float(d));        } catch (ConversionException ce) {}	return f;    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource value as a float or the specified default     *                      value  the named resource is not covertible to a     *                      long or is not resovlable.     * @throws      {@link net.jxta.ext.config.ConversionException}     thrown in the event the named     *                                              resource is not convertible to     *                                              a float or is not resolvable.     */        public float getFloat(String key, Float d)    throws ConversionException {        String s = get(key, (d != null) ? d.toString() : null);        return Conversion.toFloat(s);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @return              resource value as a boolean     */        public boolean getBoolean(String key) {        return getBoolean(key, null);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource value as a boolean or the default value if     *                      the named resourse is not convertible to a boolean     *                      or is not resolvable.     */        public boolean getBoolean(String key, boolean d) {        return getBoolean(key, Boolean.valueOf(d));    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource value as a boolean or the default value if     *                      the named resources is not convertible to a boolean     *                      or is not resolvable.     */        public boolean getBoolean(String key, Boolean d) {        String s = get(key, (d != null) ? d.toString() : null);        return Boolean.valueOf(s).booleanValue();    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @return              resource as a char     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public char getChar(String key)    throws ConversionException {        return getChar(key, new Character((char)0));    }    /**     * Accessor for a named resource     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a char or the default value if the named     *                      resource is not convertible to a char or is not     *                      resolvable.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public char getChar(String key, Character d)    throws ConversionException {        String s = get(key, (d != null) ? d.toString() : null);        return Conversion.toChar(s);    }    /**     * Accessor for a named resource     *     * @param       key     specified resource name     * @return              resource as a {@link java.net.URL}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public URL getURL(String key)    throws ConversionException {        return getURL(key, null);    }    /**     * Accessor for a named resource     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.net.URL} or the default     *                      value if the named resource is not convertible to     *                      a {@link java.net.URL} or is not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public URL getURL(String key, URL d)    throws ConversionException {        String s = get(key, (d != null) ? d.toString() : null);        return Conversion.toURL(s);    }    /**     * Accessor for a named resource     *     * @param       key     specified resource name     * @return              resource as a {@link java.util.List} of {@link java.net.URL}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public List getURLs(String key)    throws ConversionException {        return getURLs(key, null);    }    /**     * Accessor for a named resource     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.util.List} of {@link java.net.URL}     *                      or the specified default value if the named resource     *                      is not convertible to a {@link java.net.URL} or is     *                      not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public List getURLs(String key, URL d)    throws ConversionException {        List values = getAll(key, (d != null) ? d.toString() : null);        return Conversion.toURLs(values);    }    /**     * Accessor for the named resource.     *     * @param       key     specified resource name     * @return              resource as a {@link java.net.URI}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public URI getURI(String key)    throws ConversionException {        return getURI(key, null);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.net.URI} or the default     *                      value if the named resource is not convertible to     *                      a {@link java.net.URI} or is not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public URI getURI(String key, URI d)    throws ConversionException {        String s = get(key, (d != null) ? d.toString() : null);        return s != null ? Conversion.toURI(s) : null;    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @return              resource as a {@link java.util.List} of {@link java.net.URI}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public List getURIs(String key)    throws ConversionException {        return getURIs(key, null);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.util.List} of {@link java.net.URI}     *                      or the specified default value if the named resource     *                      is not convertible to a {@link java.net.URI} or is     *                      not resolvible.     * @exception   {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public List getURIs(String key, URI d)    throws ConversionException {        List values = getAll(key, (d != null) ? d.toString() : null);        return Conversion.toURIs(values);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @return              resource as a {@link java.awt.Color}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public Color getColor(String key)    throws ConversionException {        return getColor(key, null);    }    /**     * Accessor for a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.util.Color} or the specified     *                      default value if the named resource is not convertible     *                      to a {@link java.awt.Color} or is not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible or     *                                          is not resolvable.     */        public Color getColor(String key, Color d)    throws ConversionException {        String s = get(key, (d != null) ? d.toString() : null);        return Conversion.toColor(s);    }    /**     * Accessor to a named resource.     *     * @param       key     specified resource name     * @return              named {@link net.jxta.ext.config.Resource}     */        public Resource getResource(String key) {        List r = getResources(key);        return r != null ? (Resource)r.get(0) : null;    }    /**     * Accessor to the resources.     *     * @param       key     specified resource name     * @return              named {@link net.jxta.ext.config.Resource} as a {@link java.util.List}     */        public List getResources(String key) {        List r = new ArrayList();        for (Iterator v = getValues(key).iterator(); v.hasNext(); ) {            Object o = v.next();            if (o instanceof Element) {                Resource cr = new Resource();                try {                    cr.load(new ByteArrayInputStream(toString((Element)o).getBytes()));                } catch (ResourceNotFoundException rnfe) {                }                r.add(cr);            }        }        return r;    }    /**     * Accessor to a named resource.     *     * @param       key     specified resource name     * @return              resource as a {@link java.lang.Class}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible to     *                                          a {@link java.lang.Class} or is     *                                          not resolvable.     */        public Class getClass(String key)    throws ConversionException {        return getClass(key, null);    }    /**     * Accessor to a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.lang.Class} or the default     *                      value if the named resource is not converibile to a     *                      {@link java.lang.Class} or is not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible to     *                                          a {@link java.lang.Class} or is     *                                          not resolvable.     */        public Class getClass(String key, Class d)    throws ConversionException {        String s = get(key, (d != null) ? d.getName() : null);        return Conversion.toClass(s);    }    /**     * Accessor to a named resource.     *     * @param       key     specified resource name     * @return              resource as a {@link java.util.List} of {@link java.lang.Class}     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible to     *                                          a {@link java.lang.Class} or is     *                                          not resolvable.     */        public List getClasses(String key)    throws ConversionException {        return getClasses(key, null);    }    /**     * Accessor to a named resource.     *     * @param       key     specified resource name     * @param       d       specified default value     * @return              resource as a {@link java.util.List} of {@link java.lang.Class}     *                      or the specified default value if the named resource     *                      is not convertible to a {@link java.lang.Class} or is     *                      not resolvible.     * @throws      {@link net.jxta.ext.config.ConversionException} thrown in the event the named     *                                          resource is not convertible to     *                                          a {@link java.lang.Class} or is     *                                          not resovlable.     */        public List getClasses(String key, URL d)    throws ConversionException {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -