• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ObjectFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xalan.internal.utils.ObjectFactory的典型用法代码示例。如果您正苦于以下问题:Java ObjectFactory类的具体用法?Java ObjectFactory怎么用?Java ObjectFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectFactory类属于com.sun.org.apache.xalan.internal.utils包,在下文中一共展示了ObjectFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadPropertyFile

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Retrieve a propery bundle from a specified file
 *
 * @param file The string name of the property file.  The name
 * should already be fully qualified as path/filename
 * @param target The target property bag the file will be placed into.
 */
public void loadPropertyFile(String file, Properties target)
{
  try
  {
    // Use SecuritySupport class to provide priveleged access to property file
    InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
                                            file);

    // get a buffered version
    BufferedInputStream bis = new BufferedInputStream(is);

    target.load(bis);  // and load up the property bag from this
    bis.close();  // close out after reading
  }
  catch (Exception ex)
  {
    // ex.printStackTrace();
    throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(ex);
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:FuncSystemProperty.java


示例2: getFunction

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Get a Function instance that this instance is liaisoning for.
 *
 * @return non-null reference to Function derivative.
 *
 * @throws javax.xml.transform.TransformerException if ClassNotFoundException,
 *    IllegalAccessException, or InstantiationException is thrown.
 */
Function getFunction() throws TransformerException
{
  try
  {
    String className = m_funcName;
    if (className.indexOf(".") < 0) {
      className = "com.sun.org.apache.xpath.internal.functions." + className;
    }
    //hack for loading only built-in function classes.
    String subString = className.substring(0,className.lastIndexOf('.'));
    if(!(subString.equals ("com.sun.org.apache.xalan.internal.templates") ||
         subString.equals ("com.sun.org.apache.xpath.internal.functions"))) {
          throw new TransformerException("Application can't install his own xpath function.");
    }

    return (Function) ObjectFactory.newInstance(className, true);

  }
  catch (ConfigurationError e)
  {
    throw new TransformerException(e.getException());
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:FuncLoader.java


示例3: checkJAXPVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report version information about JAXP interfaces.
 *
 * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1,
 * and not found; only tests the interfaces, and does not
 * check for reference implementation versions.
 *
 * @param h Map to put information in
 */
protected void checkJAXPVersion(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  Class clazz = null;

  try
  {
    final String JAXP1_CLASS = "javax.xml.stream.XMLStreamConstants";

    clazz = ObjectFactory.findProviderClass(JAXP1_CLASS, true);

    // If we succeeded, we have JAXP 1.4 available
    h.put(VERSION + "JAXP", "1.4");
  }
  catch (Exception e)
  {
      h.put(ERROR + VERSION + "JAXP", "1.3");
      h.put(ERROR, ERROR_FOUND);
    }
    }
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:33,代码来源:EnvironmentCheck.java


示例4: checkAntVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report product version information from Ant.
 *
 * @param h Map to put information in
 */
protected void checkAntVersion(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  try
  {
    final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
    final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
    final Class noArgs[] = new Class[0];

    Class clazz = ObjectFactory.findProviderClass(ANT_VERSION_CLASS, true);

    Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
    Object returnValue = method.invoke(null, new Object[0]);

    h.put(VERSION + "ant", (String)returnValue);
  }
  catch (Exception e)
  {
    h.put(VERSION + "ant", CLASS_NOTPRESENT);
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:30,代码来源:EnvironmentCheck.java


示例5: checkDOML3

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report version info from DOM interfaces.
 *
 * @param h Map to put information in
 */
protected boolean checkDOML3(Map<String, Object> h)
{

  if (null == h)
    h = new HashMap<>();

  final String DOM_CLASS = "org.w3c.dom.Document";
  final String DOM_LEVEL3_METHOD = "getDoctype";  // no parameter

  try
  {
    Class clazz = ObjectFactory.findProviderClass(DOM_CLASS, true);

    Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class<?>[])null);

    // If we succeeded, we have loaded interfaces from a
    //  level 3 DOM somewhere
    h.put(VERSION + "DOM", "3.0");
    return true;
  }
  catch (Exception e)
  {
    return false;
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:31,代码来源:EnvironmentCheck.java


示例6: checkJAXPVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report version information about JAXP interfaces.
 *
 * Currently distinguishes between JAXP 1.0.1 and JAXP 1.1,
 * and not found; only tests the interfaces, and does not
 * check for reference implementation versions.
 *
 * @param h Hashtable to put information in
 */
protected void checkJAXPVersion(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  Class clazz = null;

  try
  {
    final String JAXP1_CLASS = "javax.xml.stream.XMLStreamConstants";

    clazz = ObjectFactory.findProviderClass(JAXP1_CLASS, true);

    // If we succeeded, we have JAXP 1.4 available
    h.put(VERSION + "JAXP", "1.4");
  }
  catch (Exception e)
  {
      h.put(ERROR + VERSION + "JAXP", "1.3");
      h.put(ERROR, ERROR_FOUND);
    }
    }
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:33,代码来源:EnvironmentCheck.java


示例7: checkAntVersion

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report product version information from Ant.
 *
 * @param h Hashtable to put information in
 */
protected void checkAntVersion(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  try
  {
    final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
    final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
    final Class noArgs[] = new Class[0];

    Class clazz = ObjectFactory.findProviderClass(ANT_VERSION_CLASS, true);

    Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
    Object returnValue = method.invoke(null, new Object[0]);

    h.put(VERSION + "ant", (String)returnValue);
  }
  catch (Exception e)
  {
    h.put(VERSION + "ant", CLASS_NOTPRESENT);
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:30,代码来源:EnvironmentCheck.java


示例8: checkDOML3

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Report version info from DOM interfaces.
 *
 * @param h Hashtable to put information in
 */
protected boolean checkDOML3(Hashtable h)
{

  if (null == h)
    h = new Hashtable();

  final String DOM_CLASS = "org.w3c.dom.Document";
  final String DOM_LEVEL3_METHOD = "getDoctype";  // no parameter

  try
  {
    Class clazz = ObjectFactory.findProviderClass(DOM_CLASS, true);

    Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class<?>[])null);

    // If we succeeded, we have loaded interfaces from a
    //  level 3 DOM somewhere
    h.put(VERSION + "DOM", "3.0");
    return true;
  }
  catch (Exception e)
  {
    return false;
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:31,代码来源:EnvironmentCheck.java


示例9: getDTMManagerClass

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
public static Class getDTMManagerClass(boolean useServicesMechanism) {
    Class mgrClass = null;
    if (useServicesMechanism) {
        mgrClass = ObjectFactory.lookUpFactoryClass(DEFAULT_PROP_NAME,
                                                      null,
                                                      DEFAULT_CLASS_NAME);
    } else {
        try {
            mgrClass = ObjectFactory.findProviderClass(DEFAULT_CLASS_NAME, true);
        } catch (Exception e) {
            //will not happen
        }
    }
    // If no class found, default to this one.  (This should never happen -
    // the ObjectFactory has already been told that the current class is
    // the default).
    return (mgrClass != null) ? mgrClass : XSLTCDTMManager.class;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:19,代码来源:XSLTCDTMManager.java


示例10: checkEnvironmentUsingWhich

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Private worker method to attempt to use org.apache.env.Which.
 *
 * @param myContext an <code>ExpressionContext</code> passed in by the
 *                  extension mechanism.  This must be an XPathContext.
 * @param factoryDocument providing createElement services, etc.
 * @return a Node with environment info; null if any error
 */
private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
      Document factoryDocument)
{
  final String WHICH_CLASSNAME = "org.apache.env.Which";
  final String WHICH_METHODNAME = "which";
  final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
                                      java.lang.String.class,
                                      java.lang.String.class };
  try
  {
    // Use reflection to try to find xml-commons utility 'Which'
    Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
    if (null == clazz)
      return null;

    // Fully qualify names since this is the only method they're used in
    java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
    Hashtable report = new Hashtable();

    // Call the method with our Hashtable, common options, and ignore return value
    Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
    Object returnValue = method.invoke(null, methodArgs);

    // Create a parent to hold the report and append hash to it
    Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
    com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
          resultNode, factoryDocument);

    return resultNode;
  }
  catch (Throwable t)
  {
    // Simply return null; no need to report error
    return null;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:Extensions.java


示例11: ObjectType

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Used to represent a Java Class type such is required to support
 * non-static java functions.
 * @param javaClassName name of the class such as 'com.foo.Processor'
 */
protected ObjectType(String javaClassName) {
    _javaClassName = javaClassName;

    try {
      _clazz = ObjectFactory.findProviderClass(javaClassName, true);
    }
    catch (ClassNotFoundException e) {
      _clazz = null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:ObjectType.java


示例12: ObjectPool

import com.sun.org.apache.xalan.internal.utils.ObjectFactory; //导入依赖的package包/类
/**
 * Constructor ObjectPool
 *
 * @param className Fully qualified name of the type of objects for this pool.
 */
public ObjectPool(String className)
{
  try
  {
    objectType = ObjectFactory.findProviderClass(className, true);
  }
  catch(ClassNotFoundException cnfe)
  {
    throw new WrappedRuntimeException(cnfe);
  }
  freeStack = new ArrayList();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ObjectPool.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Cell类代码示例发布时间:2022-05-23
下一篇:
Java ValuePair类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap