public GroovyRuntimeBeanReference(String beanName, GroovyBeanDefinitionWrapper beanDefinition, boolean toParent) { super(beanName, toParent); this.beanDefinition = beanDefinition; this.metaClass = InvokerHelper.getMetaClass(this); }
@Override public Object invokeMethod(String name, Object args) { return InvokerHelper.invokeMethod(this.propertyValue, name, args); }
@Override public Object getProperty(String name) { return InvokerHelper.getProperty(this.propertyValue, name); }
public void testDecrementString() throws Exception { String original = "a"; String answer = StringGroovyMethods.previous(original); assertEquals("`", answer); assertTrue(ScriptBytecodeAdapter.compareLessThan(answer, original)); }
public static void setProperty(Object messageArgument, Class senderClass, Object receiver, String messageName) throws Throwable { try { if (receiver==null) receiver=NullObject.getNullObject(); InvokerHelper.setProperty(receiver, messageName, messageArgument); } catch (GroovyRuntimeException gre) { throw unwrap(gre); } }
protected void assertGetProperty(Object object, String property, Object expected) { Object value = InvokerHelper.getProperty(object, property); assertEquals("property: " + property + " of: " + object, expected, value); } }
@Override public void setProperty(String name, Object value) { InvokerHelper.setProperty(this.propertyValue, name, value); }
protected void assertGetSetProperty(Object object, String property, Object currentValue, Object newValue) { assertGetProperty(object, property, currentValue); InvokerHelper.setProperty(object, property, newValue); assertGetProperty(object, property, newValue); }
public void testDefaultImplementation() throws Exception { MethodKey a = new DefaultMethodKey(Object.class, "foo", new Class[]{Object.class, Integer.class}, false); MethodKey a2 = new DefaultMethodKey(Object.class, "foo", new Class[]{Object.class, Integer.class}, false); MethodKey b = new DefaultMethodKey(Object.class, "foo", new Class[]{Object.class}, false); MethodKey c = new DefaultMethodKey(Object.class, "bar", new Class[]{Object.class, Integer.class}, false); assertCompare(a, a, true); assertCompare(a, a2, true); assertCompare(b, b, true); assertCompare(a, b, false); assertCompare(a, c, false); assertCompare(b, c, false); }
/** * Read the content of the Path and returns it as a byte[]. * * @param self the file whose content we want to read * @return a String containing the content of the file * @throws java.io.IOException if an IOException occurs. * @since 2.3.0 */ public static byte[] getBytes(Path self) throws IOException { return IOGroovyMethods.getBytes(Files.newInputStream(self)); }
/** * Write the bytes from the byte array to the Path. * * @param self the file to write to * @param bytes the byte[] to write to the file * @throws java.io.IOException if an IOException occurs. * @since 2.3.0 */ public static void setBytes(Path self, byte[] bytes) throws IOException { IOGroovyMethods.setBytes(Files.newOutputStream(self), bytes); }
/** * Append binary data to the file. See {@link #append(Path, java.io.InputStream)} * * @param path a Path * @param data an InputStream of data to write to the file * @return the file * @throws java.io.IOException if an IOException occurs. * @since 2.3.0 */ public static Path leftShift(Path path, InputStream data) throws IOException { append(path, data); return path; }
@Override public Object invokeMethod(String name, Object args) { return InvokerHelper.invokeMethod(this.propertyValue, name, args); }
public GroovyRuntimeBeanReference(String beanName, GroovyBeanDefinitionWrapper beanDefinition, boolean toParent) { super(beanName, toParent); this.beanDefinition = beanDefinition; this.metaClass = InvokerHelper.getMetaClass(this); }
@Override public Object getProperty(String name) { return InvokerHelper.getProperty(this.propertyValue, name); }
@Override public void setProperty(String name, Object value) { InvokerHelper.setProperty(this.propertyValue, name, value); }
public boolean add(Object value) { boolean retVal = (Boolean) InvokerHelper.invokeMethod(this.propertyValue, "add", value); updateDeferredProperties(value); return retVal; }
public ConfigurableRuntimeBeanReference(String beanName, BeanConfiguration beanConfig, boolean toParent) { super(beanName, toParent); this.beanConfig = beanConfig; if(beanConfig == null) throw new IllegalArgumentException("Argument [beanConfig] cannot be null"); this.metaClass = InvokerHelper.getMetaClass(this); }
public boolean addAll(Collection values) { boolean retVal = (Boolean) InvokerHelper.invokeMethod(this.propertyValue, "addAll", values); for (Object value : values) { updateDeferredProperties(value); } return retVal; }
public void leftShift(Object value) { InvokerHelper.invokeMethod(this.propertyValue, "leftShift", value); updateDeferredProperties(value); }