本文整理汇总了Java中com.sun.org.apache.xerces.internal.utils.ObjectFactory类的典型用法代码示例。如果您正苦于以下问题:Java ObjectFactory类的具体用法?Java ObjectFactory怎么用?Java ObjectFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectFactory类属于com.sun.org.apache.xerces.internal.utils包,在下文中一共展示了ObjectFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerPreparser
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
public boolean registerPreparser(String grammarType, XMLGrammarLoader loader) {
if(loader == null) { // none specified!
if(KNOWN_LOADERS.containsKey(grammarType)) {
// got one; just instantiate it...
String loaderName = (String)KNOWN_LOADERS.get(grammarType);
try {
XMLGrammarLoader gl = (XMLGrammarLoader)(ObjectFactory.newInstance(loaderName, true));
fLoaders.put(grammarType, gl);
} catch (Exception e) {
return false;
}
return true;
}
return false;
}
// were given one
fLoaders.put(grammarType, loader);
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:XMLGrammarPreparser.java
示例2: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* DOM Level 3 WD - Experimental.
*/
public Object getFeature(String feature, String version) {
if (singleton.hasFeature(feature, version)) {
if ((feature.equalsIgnoreCase("+XPath"))) {
try {
Class xpathClass = ObjectFactory.findProviderClass(
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
return xpathClass.newInstance();
}
}
} catch (Exception e) {
return null;
}
} else {
return singleton;
}
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:CoreDOMImplementationImpl.java
示例3: getInstance
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* Get an instance of DTDDVFactory implementation.
*
* @param factoryClass name of the implementation to load.
* @return an instance of DTDDVFactory implementation
* @exception DVFactoryException cannot create an instance of the specified
* class name or the default class name
*/
public static final DTDDVFactory getInstance(String factoryClass) throws DVFactoryException {
try {
if (DEFAULT_FACTORY_CLASS.equals(factoryClass)) {
return new DTDDVFactoryImpl();
} else if (XML11_DATATYPE_VALIDATOR_FACTORY.equals(factoryClass)) {
return new XML11DTDDVFactoryImpl();
} else {
//fall back for compatibility
return (DTDDVFactory)
(ObjectFactory.newInstance(factoryClass, true));
}
}
catch (ClassCastException e) {
throw new DVFactoryException("DTD factory class " + factoryClass + " does not extend from DTDDVFactory.");
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:DTDDVFactory.java
示例4: setDocumentClassName
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* This method allows the programmer to decide which document
* factory to use when constructing the DOM tree. However, doing
* so will lose the functionality of the default factory. Also,
* a document class other than the default will lose the ability
* to defer node expansion on the DOM tree produced.
*
* @param documentClassName The fully qualified class name of the
* document factory to use when constructing
* the DOM tree.
*
* @see #getDocumentClassName
* @see #DEFAULT_DOCUMENT_CLASS_NAME
*/
protected void setDocumentClassName (String documentClassName) {
// normalize class name
if (documentClassName == null) {
documentClassName = DEFAULT_DOCUMENT_CLASS_NAME;
}
if (!documentClassName.equals(DEFAULT_DOCUMENT_CLASS_NAME) &&
!documentClassName.equals(PSVI_DOCUMENT_CLASS_NAME)) {
// verify that this class exists and is of the right type
try {
Class _class = ObjectFactory.findProviderClass (documentClassName, true);
//if (!_class.isAssignableFrom(Document.class)) {
if (!Document.class.isAssignableFrom (_class)) {
throw new IllegalArgumentException (
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"InvalidDocumentClassName", new Object [] {documentClassName}));
}
}
catch (ClassNotFoundException e) {
throw new IllegalArgumentException (
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"MissingDocumentClassName", new Object [] {documentClassName}));
}
}
// set document class name
fDocumentClassName = documentClassName;
if (!documentClassName.equals (DEFAULT_DOCUMENT_CLASS_NAME)) {
fDeferNodeExpansion = false;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:AbstractDOMParser.java
示例5: getInstance
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* Get an instance of DTDDVFactory implementation.
*
* @param factoryClass name of the implementation to load.
* @return an instance of DTDDVFactory implementation
* @exception DVFactoryException cannot create an instance of the specified
* class name or the default class name
*/
public static final DTDDVFactory getInstance(String factoryClass) throws DVFactoryException {
try {
// if the class name is not specified, use the default one
return (DTDDVFactory)
(ObjectFactory.newInstance(factoryClass, true));
}
catch (ClassCastException e) {
throw new DVFactoryException("DTD factory class " + factoryClass + " does not extend from DTDDVFactory.");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:DTDDVFactory.java
示例6: getInstance
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* Get an instance of SchemaDVFactory implementation.
*
* @param factoryClass name of the schema factory implementation to instantiate.
* @return an instance of SchemaDVFactory implementation
* @exception DVFactoryException cannot create an instance of the specified
* class name or the default class name
*/
public static synchronized final SchemaDVFactory getInstance(String factoryClass) throws DVFactoryException {
try {
// if the class name is not specified, use the default one
return (SchemaDVFactory)(ObjectFactory.newInstance(factoryClass, true));
} catch (ClassCastException e4) {
throw new DVFactoryException("Schema factory class " + factoryClass + " does not extend from SchemaDVFactory.");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:SchemaDVFactory.java
示例7: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* @since DOM Level 3
*/
public Object getFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are
// considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
// If an XPathEvaluator was created previously
// return it otherwise create a new one.
if (fXPathEvaluator != null) {
return fXPathEvaluator;
}
try {
Class xpathClass = ObjectFactory.findProviderClass (
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
Constructor xpathClassConstr =
xpathClass.getConstructor(new Class[] { Document.class });
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
fXPathEvaluator = xpathClassConstr.newInstance(new Object[] { this });
return fXPathEvaluator;
}
}
return null;
} catch (Exception e) {
return null;
}
}
return super.getFeature(feature, version);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:CoreDocumentImpl.java
示例8: hasFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* Test if the DOM implementation supports a specific "feature" --
* currently meaning language and level thereof.
*
* @param feature The package name of the feature to test.
* In Level 1, supported values are "HTML" and "XML" (case-insensitive).
* At this writing, com.sun.org.apache.xerces.internal.dom supports only XML.
*
* @param version The version number of the feature being tested.
* This is interpreted as "Version of the DOM API supported for the
* specified Feature", and in Level 1 should be "1.0"
*
* @return true iff this implementation is compatable with the specified
* feature and version.
*/
public boolean hasFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// check if Xalan implementation is around and if yes report true for supporting
// XPath API
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
try {
Class xpathClass = ObjectFactory.findProviderClass(
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
return true;
}
}
} catch (Exception e) {
return false;
}
return true;
}
if (feature.startsWith("+")) {
feature = feature.substring(1);
}
return (
feature.equalsIgnoreCase("Core")
&& (anyVersion
|| version.equals("1.0")
|| version.equals("2.0")
|| version.equals("3.0")))
|| (feature.equalsIgnoreCase("XML")
&& (anyVersion
|| version.equals("1.0")
|| version.equals("2.0")
|| version.equals("3.0")))
|| (feature.equalsIgnoreCase("LS")
&& (anyVersion || version.equals("3.0")));
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:CoreDOMImplementationImpl.java
示例9: getFeature
import com.sun.org.apache.xerces.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
* @since DOM Level 3
*/
public Object getFeature(String feature, String version) {
boolean anyVersion = version == null || version.length() == 0;
// if a plus sign "+" is prepended to any feature name, implementations
// are considered in which the specified feature may not be directly
// castable DOMImplementation.getFeature(feature, version). Without a
// plus, only features whose interfaces are directly castable are
// considered.
if ((feature.equalsIgnoreCase("+XPath"))
&& (anyVersion || version.equals("3.0"))) {
// If an XPathEvaluator was created previously
// return it otherwise create a new one.
if (fXPathEvaluator != null) {
return fXPathEvaluator;
}
try {
Class xpathClass = ObjectFactory.findProviderClass (
"com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl", true);
Constructor xpathClassConstr =
xpathClass.getConstructor(new Class[] { Document.class });
// Check if the DOM XPath implementation implements
// the interface org.w3c.dom.XPathEvaluator
Class interfaces[] = xpathClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getName().equals(
"org.w3c.dom.xpath.XPathEvaluator")) {
fXPathEvaluator = xpathClassConstr.newInstance(new Object[] { this });
return fXPathEvaluator;
}
}
return null;
} catch (Exception e) {
return null;
}
}
return super.getFeature(feature, version);
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:45,代码来源:CoreDocumentImpl.java
注:本文中的com.sun.org.apache.xerces.internal.utils.ObjectFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论