本文整理汇总了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);
}
示例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);
}