| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
package org.apache.tapestry5.internal.bindings; |
| 16 | |
|
| 17 | |
import org.apache.tapestry5.ComponentResources; |
| 18 | |
import org.apache.tapestry5.ioc.Location; |
| 19 | |
|
| 20 | |
public class RenderVariableBinding extends AbstractBinding |
| 21 | |
{ |
| 22 | |
private final String description; |
| 23 | |
private final ComponentResources resources; |
| 24 | |
private final String name; |
| 25 | |
|
| 26 | |
public RenderVariableBinding(Location location, String description, ComponentResources resources, String name |
| 27 | |
) |
| 28 | |
{ |
| 29 | 18 | super(location); |
| 30 | |
|
| 31 | 18 | this.description = description; |
| 32 | 18 | this.resources = resources; |
| 33 | 18 | this.name = name; |
| 34 | 18 | } |
| 35 | |
|
| 36 | |
@Override |
| 37 | |
public void set(Object value) |
| 38 | |
{ |
| 39 | 6604 | resources.storeRenderVariable(name, value); |
| 40 | 6604 | } |
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
@Override |
| 46 | |
public boolean isInvariant() |
| 47 | |
{ |
| 48 | 1026 | return false; |
| 49 | |
} |
| 50 | |
|
| 51 | |
@Override |
| 52 | |
public String toString() |
| 53 | |
{ |
| 54 | 0 | return String.format("RenderVariable[%s %s]", description, name); |
| 55 | |
} |
| 56 | |
|
| 57 | |
|
| 58 | |
public Object get() |
| 59 | |
{ |
| 60 | 6616 | return resources.getRenderVariable(name); |
| 61 | |
} |
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
@Override |
| 67 | |
public Class getBindingType() |
| 68 | |
{ |
| 69 | 6612 | return Object.class; |
| 70 | |
} |
| 71 | |
} |