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


Java Constants.REUSE_INSTANCE属性代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.Constants.REUSE_INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.REUSE_INSTANCE属性的具体用法?Java Constants.REUSE_INSTANCE怎么用?Java Constants.REUSE_INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.org.apache.xerces.internal.impl.Constants的用法示例。


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

示例1: setProperty

public void setProperty(String name, Object value) throws java.lang.IllegalArgumentException {
    if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
        throw new IllegalArgumentException("Property "+name+"is not supported");
    }
    if(name == Constants.REUSE_INSTANCE || name.equals(Constants.REUSE_INSTANCE)){
        fReuseInstance = ((Boolean)value).booleanValue();
        if(DEBUG)System.out.println("fReuseInstance is set to " + fReuseInstance);

        // TODO: XMLStreamWriters are not Thread safe,
        // don't let application think it is optimizing
        if (fReuseInstance) {
            throw new IllegalArgumentException(
                    "Property "
                    + name
                    + " is not supported: XMLStreamWriters are not Thread safe");
        }
    }else{//for any other property set the flag
        //REVISIT: Even in this case instance can be reused, by passing PropertyManager
        fPropertyChanged = true;
    }
    fPropertyManager.setProperty(name,value);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XMLOutputFactoryImpl.java

示例2: setProperty

/** Allows the user to set specific feature/property on the underlying implementation. The underlying implementation
 * is not required to support every setting of every property in the specification and may use IllegalArgumentException
 * to signal that an unsupported property may not be set with the specified value.
 * @param name The name of the property (may not be null)
 * @param value The value of the property
 * @throws java.lang.IllegalArgumentException if the property is not supported
 */
public void setProperty(java.lang.String name, Object value) throws java.lang.IllegalArgumentException {

    if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
        throw new IllegalArgumentException("Property "+name+" is not supported");
    }
    if(name == Constants.REUSE_INSTANCE || name.equals(Constants.REUSE_INSTANCE)){
        fReuseInstance = ((Boolean)value).booleanValue();
        if(DEBUG)System.out.println("fReuseInstance is set to " + fReuseInstance);
    }else{//for any other property set the flag
        //REVISIT: Even in this case instance can be reused, by passing PropertyManager
        fPropertyChanged = true;
    }
    fPropertyManager.setProperty(name,value);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:XMLInputFactoryImpl.java


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