| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Argument |
|
| 1.25;1.25 |
| 1 | /* | |
| 2 | * Copyright (C) 1998-2000 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 | ||
| 27 | /** | |
| 28 | * A predicate is a term passed to a Directive. It consists of a string | |
| 29 | * word representing the action to beformed, and a target object on which | |
| 30 | * to perform the action. The target object can be any kind of WebMacro | |
| 31 | * term. | |
| 32 | */ | |
| 33 | public final class Argument | |
| 34 | { | |
| 35 | ||
| 36 | private String _name; | |
| 37 | private Object _value; | |
| 38 | ||
| 39 | /** | |
| 40 | * Create a new predicate | |
| 41 | */ | |
| 42 | public Argument (String name, Object value) | |
| 43 | 0 | { |
| 44 | 0 | _name = name; |
| 45 | 0 | _value = value; |
| 46 | 0 | } |
| 47 | ||
| 48 | /** | |
| 49 | * Return the action code for this predicate | |
| 50 | */ | |
| 51 | final public String getName () | |
| 52 | { | |
| 53 | 0 | return _name; |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * Return the object on which this predicate operates | |
| 58 | */ | |
| 59 | final public Object getValue () | |
| 60 | { | |
| 61 | 0 | return _value; |
| 62 | } | |
| 63 | ||
| 64 | /** | |
| 65 | * Make sure that _value is not a builder! Not a public method, | |
| 66 | * used by Directivebuilder and other things that build Argument | |
| 67 | * lists. | |
| 68 | */ | |
| 69 | final void build (BuildContext bc) throws BuildException | |
| 70 | { | |
| 71 | 0 | if (_value instanceof Builder) |
| 72 | { | |
| 73 | 0 | _value = ((Builder) _value).build(bc); |
| 74 | } | |
| 75 | 0 | } |
| 76 | ||
| 77 | } |