return LazyMap.decorate(map, factory);
return LazyMap.decorate(map, factory);
return LazyMap.decorate(map, transformerFactory);
return LazyMap.decorate(map, transformerFactory);
protected Map decorateMap(Map map, Factory factory) { return LazyMap.decorate(map, factory); }
final Map lazyMap = LazyMap.decorate(innerMap, transformerChain);
public BadAttributeValueExpException getObject(final String command) throws Exception { final String[] execArgs = new String[] { command }; // inert chain for setup final Transformer transformerChain = new ChainedTransformer( new Transformer[]{ new ConstantTransformer(1) }); // real chain for after setup final Transformer[] transformers = new Transformer[] { new ConstantTransformer(Runtime.class), new InvokerTransformer("getMethod", new Class[] { String.class, Class[].class }, new Object[] { "getRuntime", new Class[0] }), new InvokerTransformer("invoke", new Class[] { Object.class, Object[].class }, new Object[] { null, new Object[0] }), new InvokerTransformer("exec", new Class[] { String.class }, execArgs), new ConstantTransformer(1) }; final Map innerMap = new HashMap(); final Map lazyMap = LazyMap.decorate(innerMap, transformerChain); TiedMapEntry entry = new TiedMapEntry(lazyMap, "foo"); BadAttributeValueExpException val = new BadAttributeValueExpException(null); Field valfield = val.getClass().getDeclaredField("val"); valfield.setAccessible(true); valfield.set(val, entry); Reflections.setFieldValue(transformerChain, "iTransformers", transformers); // arm with actual transformer chain return val; }
public Object getObject(final String command) throws Exception { Object templatesImpl = Gadgets.createTemplatesImpl(command); // inert chain for setup final Transformer transformerChain = new ChainedTransformer( new Transformer[]{ new ConstantTransformer(1) }); // real chain for after setup final Transformer[] transformers = new Transformer[] { new ConstantTransformer(TrAXFilter.class), new InstantiateTransformer( new Class[] { Templates.class }, new Object[] { templatesImpl } )}; final Map innerMap = new HashMap(); final Map lazyMap = LazyMap.decorate(innerMap, transformerChain); final Map mapProxy = Gadgets.createMemoitizedProxy(lazyMap, Map.class); final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(mapProxy); Reflections.setFieldValue(transformerChain, "iTransformers", transformers); // arm with actual transformer chain return handler; }
public InvocationHandler getObject(final String command) throws Exception { final String[] execArgs = new String[] { command }; // inert chain for setup final Transformer transformerChain = new ChainedTransformer( new Transformer[]{ new ConstantTransformer(1) }); // real chain for after setup final Transformer[] transformers = new Transformer[] { new ConstantTransformer(Runtime.class), new InvokerTransformer("getMethod", new Class[] { String.class, Class[].class }, new Object[] { "getRuntime", new Class[0] }), new InvokerTransformer("invoke", new Class[] { Object.class, Object[].class }, new Object[] { null, new Object[0] }), new InvokerTransformer("exec", new Class[] { String.class }, execArgs), new ConstantTransformer(1) }; final Map innerMap = new HashMap(); final Map lazyMap = LazyMap.decorate(innerMap, transformerChain); final Map mapProxy = Gadgets.createMemoitizedProxy(lazyMap, Map.class); final InvocationHandler handler = Gadgets.createMemoizedInvocationHandler(mapProxy); Reflections.setFieldValue(transformerChain, "iTransformers", transformers); // arm with actual transformer chain return handler; }
/** * Provides a wrapper to access the {@link LazyMap} functionality that avoids warnings with Java 1.5 generic code.<p> * * @param <K> the type of keys maintained by the returned map * @param <V> the type of mapped values * @param T the transformer to use for the Lazy Map * * @return a {@link LazyMap} of the required generic type */ public static <K, V> Map<K, V> createLazyMap(Transformer T) { return LazyMap.decorate(new HashMap<K, V>(), T); }
public FacetPredicate(WikittySearchEngine searchEngine, WikittyTransaction tx, WikittyQuery query) { this.searchEngine = searchEngine; this.tx = tx; this.query = query; topic = LazyMap.decorate(new HashMap(), new Factory() { public Object create() { return TreeMultiset.create(genericComparator); } }); }
@SuppressWarnings("unchecked") private synchronized void createCollections() { openFileClassToHandler = LazyMap.decorate(new HashMap(), MAP_FACTORY); openFileToHandler = LazyMap.decorate(new HashMap(), SET_FACTORY); openClassToTypes = LazyMap.decorate(new HashMap(), SET_FACTORY); openClassToHandlers = LazyMap.decorate(new HashMap(), SET_FACTORY); saveFileClassToHandler = LazyMap.decorate(new HashMap(), MAP_FACTORY); saveFileToHandler = LazyMap.decorate(new HashMap(), SET_FACTORY); saveClassToTypes = LazyMap.decorate(new HashMap(), SET_FACTORY); saveClassToHandlers = LazyMap.decorate(new HashMap(), SET_FACTORY); }
@SuppressWarnings("unchecked") public Object create() { return LazyMap.decorate(new HashMap(), SET_FACTORY); } }
@SuppressWarnings("unchecked") private synchronized void createCollections() { openFileClassToHandler = LazyMap.decorate(new HashMap(), MAP_FACTORY); openFileToHandler = LazyMap.decorate(new HashMap(), SET_FACTORY); openClassToTypes = LazyMap.decorate(new HashMap(), SET_FACTORY); openClassToHandlers = LazyMap.decorate(new HashMap(), SET_FACTORY); saveFileClassToHandler = LazyMap.decorate(new HashMap(), MAP_FACTORY); saveFileToHandler = LazyMap.decorate(new HashMap(), SET_FACTORY); saveClassToTypes = LazyMap.decorate(new HashMap(), SET_FACTORY); saveClassToHandlers = LazyMap.decorate(new HashMap(), SET_FACTORY); }
@SuppressWarnings("unchecked") public Object create() { return LazyMap.decorate(new HashMap(), SET_FACTORY); } }
/** * Provides a wrapper to access the {@link LazyMap} functionality that avoids warnings with Java 1.5 generic code.<p> * * @param <K> the type of keys maintained by the returned map * @param <V> the type of mapped values * @param T the transformer to use for the Lazy Map * * @return a {@link LazyMap} of the required generic type */ @SuppressWarnings("unchecked") public static <K, V> Map<K, V> createLazyMap(Transformer T) { return LazyMap.decorate(new HashMap<K, V>(), T); }
/** * Returns a lazy initialized Map that provides direct access to the XML element * for the current value from the XML content.<p> * * @return a lazy initialized Map that provides direct access to the XML element for the current value from the XML content */ public Map getXmlText() { if (m_xml == null) { m_xml = LazyMap.decorate(new HashMap(), new CmsXmlValueTransformer()); } return m_xml; }
/** @param attributes the attributes to set */ @SuppressWarnings("unchecked") public void setAttributes(Map<String, Attribute> attributes) { if (attributes == null) { this.attributes = LazyMap.decorate(new HashMap<String, Attribute>(), new AttributeFactory()); } else { this.attributes = attributes; } }
/** * @see org.apache.commons.collections.Transformer#transform(java.lang.Object) */ public Object transform(Object input) { Map result = null; // first read the resource using the lazy map CmsResource resource = (CmsResource)getReadResource().get(input); if (resource != null) { result = LazyMap.decorate(new HashMap(), new CmsPropertyLoaderSingleTransformer(resource, m_search)); } // result may still be null return (result == null) ? Collections.EMPTY_MAP : result; } }
/** * @see org.apache.commons.collections.Transformer#transform(java.lang.Object) */ public Object transform(Object input) { Locale locale = CmsJspElFunctions.convertLocale(input); Map result; if (getRawContent().hasLocale(locale)) { result = LazyMap.decorate(new HashMap(), new CmsHasValueTransformer(locale)); } else { result = CmsConstantMap.CONSTANT_BOOLEAN_FALSE_MAP; } return result; } }