| 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.Binding; |
| 18 | |
import org.apache.tapestry5.ComponentResources; |
| 19 | |
import org.apache.tapestry5.FieldTranslator; |
| 20 | |
import org.apache.tapestry5.internal.services.StringInterner; |
| 21 | |
import org.apache.tapestry5.ioc.Location; |
| 22 | |
import org.apache.tapestry5.services.BindingFactory; |
| 23 | |
import org.apache.tapestry5.services.FieldTranslatorSource; |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | 2 | public class TranslateBindingFactory implements BindingFactory |
| 30 | |
{ |
| 31 | |
private final FieldTranslatorSource source; |
| 32 | |
|
| 33 | |
private final StringInterner interner; |
| 34 | |
|
| 35 | |
public TranslateBindingFactory(FieldTranslatorSource source, StringInterner interner) |
| 36 | 2 | { |
| 37 | 2 | this.source = source; |
| 38 | 2 | this.interner = interner; |
| 39 | 2 | } |
| 40 | |
|
| 41 | |
public Binding newBinding(String description, ComponentResources container, |
| 42 | |
final ComponentResources component, final String expression, Location location) |
| 43 | |
{ |
| 44 | 2 | return new InvariantBinding(location, FieldTranslator.class, interner.intern(description + ": " + expression)) |
| 45 | |
{ |
| 46 | 2 | public Object get() |
| 47 | |
{ |
| 48 | 2 | return source.createTranslator(component, expression); |
| 49 | |
} |
| 50 | |
}; |
| 51 | |
} |
| 52 | |
} |