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


Java ConstantFactory类代码示例

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


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

示例1: visitLiteral

import org.apache.commons.collections4.functors.ConstantFactory; //导入依赖的package包/类
@Override
public Object visitLiteral(LiteralExpression literal, EdmLiteral edm_literal)
{
   try
   {
      // A literal is a Provider<?> (Functional Java)
      // Returns a Node<?> (Expression Tree)
      Object o = edm_literal.getType().valueOfString(
            edm_literal.getLiteral(),
            EdmLiteralKind.DEFAULT,
            null,
            edm_literal.getType().getDefaultType());
      return ExecutableExpressionTree.Node.createLeave(ConstantFactory.constantFactory(o));
   }
   catch (EdmException ex)
   {
      throw new RuntimeException(ex);
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:20,代码来源:FunctionalVisitor.java

示例2: nullFactory

import org.apache.commons.collections4.functors.ConstantFactory; //导入依赖的package包/类
/**
 * Gets a Factory that will return null each time the factory is used.
 * This could be useful during testing as a placeholder.
 *
 * @see org.apache.commons.collections4.functors.ConstantFactory
 * @param <T> the "type" of null object the factory should return.
 * @return the factory
 */
public static <T> Factory<T> nullFactory() {
    return ConstantFactory.<T>constantFactory(null);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:12,代码来源:FactoryUtils.java

示例3: constantFactory

import org.apache.commons.collections4.functors.ConstantFactory; //导入依赖的package包/类
/**
 * Creates a Factory that will return the same object each time the factory
 * is used. No check is made that the object is immutable. In general, only
 * immutable objects should use the constant factory. Mutable objects should
 * use the prototype factory.
 *
 * @see org.apache.commons.collections4.functors.ConstantFactory
 *
 * @param <T> the type that the factory creates
 * @param constantToReturn  the constant object to return each time in the factory
 * @return the <code>constant</code> factory.
 */
public static <T> Factory<T> constantFactory(final T constantToReturn) {
    return ConstantFactory.constantFactory(constantToReturn);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:16,代码来源:FactoryUtils.java


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