| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FunctionCallBuilder |
|
| 2.0;2 |
| 1 | /* | |
| 2 | * Copyright (C) 1998-2002 Semiotek Inc. All Rights Reserved. | |
| 3 | * | |
| 4 | * Redistribution and use in source and binary forms, with or without | |
| 5 | * modification, are permitted under the terms of either of the following | |
| 6 | * Open Source licenses: | |
| 7 | * | |
| 8 | * The GNU General Public License, version 2, or any later version, as | |
| 9 | * published by the Free Software Foundation | |
| 10 | * (http://www.fsf.org/copyleft/gpl.html); | |
| 11 | * | |
| 12 | * or | |
| 13 | * | |
| 14 | * The Semiotek Public License (http://webmacro.org/LICENSE.) | |
| 15 | * | |
| 16 | * This software is provided "as is", with NO WARRANTY, not even the | |
| 17 | * implied warranties of fitness to purpose, or merchantability. You | |
| 18 | * assume all risks and liabilities associated with its use. | |
| 19 | * | |
| 20 | * See www.webmacro.org for more information on the WebMacro project. | |
| 21 | */ | |
| 22 | ||
| 23 | ||
| 24 | package org.webmacro.engine; | |
| 25 | ||
| 26 | import org.webmacro.Macro; | |
| 27 | ||
| 28 | /** | |
| 29 | * Builder for standalone function calls $a($foo) | |
| 30 | * | |
| 31 | * @author Brian Goetz | |
| 32 | * @since 1.1 | |
| 33 | */ | |
| 34 | public class FunctionCallBuilder implements Builder | |
| 35 | { | |
| 36 | ||
| 37 | String _name; | |
| 38 | ListBuilder _args; | |
| 39 | ||
| 40 | public FunctionCallBuilder (String name, ListBuilder args) | |
| 41 | 0 | { |
| 42 | 0 | _name = name; |
| 43 | 0 | _args = args; |
| 44 | 0 | } |
| 45 | ||
| 46 | public Object build (BuildContext bc) throws BuildException | |
| 47 | { | |
| 48 | 0 | Object args = _args.build(bc); |
| 49 | 0 | if (args instanceof Macro) |
| 50 | { | |
| 51 | 0 | return new FunctionCall(_name, (Macro) args); |
| 52 | } | |
| 53 | else | |
| 54 | { | |
| 55 | 0 | return new FunctionCall(_name, (Object[]) args); |
| 56 | } | |
| 57 | } | |
| 58 | ||
| 59 | ||
| 60 | } |