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


Java Function类代码示例

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


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

示例1: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    return Collections.<String, Function>singletonMap("bad", new Function() {

        @Override
        public List<String> getArgumentNames() {
            return null;
        }

        @Override
        public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
            return "<script>alert(\"injection\");</script>";
        }

    });
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:17,代码来源:EscaperExtensionTest.java

示例2: evaluate

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Object evaluate(PebbleTemplateImpl self, EvaluationContextImpl context) throws PebbleException {
    Function function = context.getExtensionRegistry().getFunction(this.functionName);
    if (function != null) {
        return this.applyFunction(self, context, function, this.args);
    }
    return self.macro(context, this.functionName, this.args, false, this.lineNumber);
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:9,代码来源:FunctionOrMacroInvocationExpression.java

示例3: applyFunction

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
private Object applyFunction(PebbleTemplateImpl self, EvaluationContextImpl context, Function function,
                             ArgumentsNode args) throws PebbleException {
    List<Object> arguments = new ArrayList<>();

    Collections.addAll(arguments, args);

    Map<String, Object> namedArguments = args.getArgumentMap(self, context, function);
    return function.execute(namedArguments, self, context, this.getLineNumber());
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:10,代码来源:FunctionOrMacroInvocationExpression.java

示例4: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
  Map<String, Function> functions = new HashMap<>();
  functions.put(MessageSourceFunction.FUNCTION_NAME, new MessageSourceFunction(this.messageSource));
  functions.put(HasErrorsFunction.FUNCTION_NAME, new HasErrorsFunction());
  functions.put(HasGlobalErrorsFunction.FUNCTION_NAME, new HasGlobalErrorsFunction());
  functions.put(HasFieldErrorsFunction.FUNCTION_NAME, new HasFieldErrorsFunction());
  functions.put(GetAllErrorsFunction.FUNCTION_NAME, new GetAllErrorsFunction(this.messageSource));
  functions.put(GetGlobalErrorsFunction.FUNCTION_NAME, new GetGlobalErrorsFunction(this.messageSource));
  functions.put(GetFieldErrorsFunction.FUNCTION_NAME, new GetFieldErrorsFunction(this.messageSource));
  functions.put(HrefFunction.FUNCTION_NAME, new HrefFunction());
  return functions;
}
 
开发者ID:PebbleTemplates,项目名称:pebble-spring4,代码行数:14,代码来源:SpringExtension.java

示例5: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functionMap = new HashMap<>();

    for (TemplateFunction function : templateFunctions) {
        functionMap.put(function.getName(), new PebbleWrapperTemplateFunction(
                contextProvider,
                function.getName(),
                Arrays.asList(function.parameters()),
                function.getClass()));
    }

    return functionMap;
}
 
开发者ID:JavaEden,项目名称:Orchid,代码行数:15,代码来源:PebbleFunctionsExtension.java

示例6: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
  Map<String, Function> f = new HashMap<>();
  f.put("messageWithBundle", new MessageFunction(configuration, Optional.empty()));
  f.put("message", new MessageFunction(configuration, Optional.of("messages")));
  f.put("fromMap", new FromMapFunction());
  f.put("defaultOrLocale", new DefaultOrLocale());
  f.put("switchToLocale", new SwitchToLocale());
  return f;
}
 
开发者ID:digitalfondue,项目名称:stampo,代码行数:11,代码来源:PebbleExtension.java

示例7: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
/**
 * Provide 't' function, which use message source
 */
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<>();
    functions.put("t", new TranslateFunction(messageSource));
    return functions;
}
 
开发者ID:asaas,项目名称:pebble-spring-translate,代码行数:10,代码来源:TranslateExtension.java

示例8: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<>();
    functions.put("i18n", new I18NFunction());
    functions.put("range", new RangeFunction());
    functions.put("entries", new MapEntriesFunction());
    functions.put("getValue", new MapValueFunction());
    return functions;
}
 
开发者ID:FenixEdu,项目名称:fenixedu-cms,代码行数:10,代码来源:CMSExtensions.java

示例9: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<>();
    functions.put("i18n", new i18nFunction());
    return functions;
}
 
开发者ID:flapdoodle-oss,项目名称:de.flapdoodle.solid,代码行数:7,代码来源:I18nExtension.java

示例10: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<String, Function>();
    functions.put("testFunction", new TestFunction());
    return functions;
}
 
开发者ID:PebbleTemplates,项目名称:pebble-spring-boot-starter,代码行数:7,代码来源:Application.java

示例11: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
  return Collections.EMPTY_MAP;
}
 
开发者ID:mvc-spec,项目名称:ozark,代码行数:5,代码来源:CustomExtensionTwo.java

示例12: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    return null;
}
 
开发者ID:JavaEden,项目名称:Orchid,代码行数:5,代码来源:AbstractPebbleExtension.java

示例13: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
	Map<String, Function> functions = new HashMap<>(1);
	functions.put("principal", new PrincipalFunction());
    return functions;
}
 
开发者ID:hectorlf,项目名称:pebble-shiro-extension,代码行数:7,代码来源:ShiroExtension.java

示例14: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<>();
    functions.put("i18n", new I18nFunction());
    return functions;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:7,代码来源:I18nExtension.java

示例15: getFunctions

import com.mitchellbosecke.pebble.extension.Function; //导入依赖的package包/类
@Override
public Map<String, Function> getFunctions() {
    Map<String, Function> functions = new HashMap<>();
    functions.put("ng", new NgFunction());
    return functions;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:7,代码来源:AngularJSExtension.java


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