/** * Allows to add a String to null. * The result is concatenated String of the result of calling * toString() on this object and the String in the parameter. * * @param s - the String to concatenate * @return the concatenated string */ public Object plus(String s) { return getMetaClass().invokeMethod(this, "toString", new Object[]{}) + s; }
/** * Gives the meta class to an Object. */ public void getMetaClass() { Object receiver = args[0]; if (receiver == null) { mc = NullObject.getNullObject().getMetaClass(); } else if (receiver instanceof GroovyObject) { mc = ((GroovyObject) receiver).getMetaClass(); } else if (receiver instanceof Class) { Class c = (Class) receiver; ClassLoader cl = c.getClassLoader(); try { Class.forName(c.getName(), true, cl); } catch (ClassNotFoundException e) {} mc = GroovySystem.getMetaClassRegistry().getMetaClass(c); this.cache &= !ClassInfo.getClassInfo(c).hasPerInstanceMetaClasses(); } else { mc = ((MetaClassRegistryImpl) GroovySystem.getMetaClassRegistry()).getMetaClass(receiver); this.cache &= !ClassInfo.getClassInfo(receiver.getClass()).hasPerInstanceMetaClasses(); } mc.initialize(); }
public static String format(Object arguments, boolean verbose, int maxSize, boolean safe) { if (arguments == null) { final NullObject nullObject = NullObject.getNullObject(); return (String) nullObject.getMetaClass().invokeMethod(nullObject, "toString", EMPTY_ARGS);
/** * Allows to add a String to null. * The result is concatenated String of the result of calling * toString() on this object and the String in the parameter. * * @param s - the String to concatenate * @return the concatenated string */ public Object plus(String s) { return getMetaClass().invokeMethod(this, "toString", new Object[]{}) + s; }
/** * Allows to add a String to null. * The result is concatenated String of the result of calling * toString() on this object and the String in the parameter. * * @param s - the String to concatenate * @return the concatenated string */ public Object plus(String s) { return getMetaClass().invokeMethod(this, "toString", new Object[]{}) + s; }
/** * Allows to add a String to null. * The result is concatenated String of the result of calling * toString() on this object and the String in the parameter. * * @param s - the String to concatenate * @return the concatenated string */ public Object plus(String s) { return getMetaClass().invokeMethod(this, "toString", new Object[]{}) + s; }
/** * Allows to add a String to null. * The result is concatenated String of the result of calling * toString() on this object and the String in the parameter. * * @param s - the String to concatenate * @return the concatenated string */ public Object plus(String s) { return getMetaClass().invokeMethod(this, "toString", new Object[]{}) + s; }
protected static String format(Object arguments, boolean verbose) { if (arguments == null) { final NullObject nullObject = NullObject.getNullObject(); return (String) nullObject.getMetaClass().invokeMethod(nullObject, "toString", EMPTY_ARGS);
protected static String format(Object arguments, boolean verbose) { if (arguments == null) { final NullObject nullObject = NullObject.getNullObject(); return (String) nullObject.getMetaClass().invokeMethod(nullObject, "toString", EMPTY_ARGS);
public static String format(Object arguments, boolean verbose, int maxSize) { if (arguments == null) { final NullObject nullObject = NullObject.getNullObject(); return (String) nullObject.getMetaClass().invokeMethod(nullObject, "toString", EMPTY_ARGS);
protected static String format(Object arguments, boolean verbose) { if (arguments == null) { final NullObject nullObject = NullObject.getNullObject(); return (String) nullObject.getMetaClass().invokeMethod(nullObject, "toString", EMPTY_ARGS);