本文整理汇总了Java中org.codehaus.groovy.runtime.InvokerHelper.toString方法的典型用法代码示例。如果您正苦于以下问题:Java InvokerHelper.toString方法的具体用法?Java InvokerHelper.toString怎么用?Java InvokerHelper.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.runtime.InvokerHelper
的用法示例。
在下文中一共展示了InvokerHelper.toString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resultToString
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
public static String resultToString(Object obj) {
if (obj instanceof Vertex) {
return LazyVertex.toString((Vertex) obj);
}
if (obj instanceof Edge) {
return LazyEdge.toString((Edge) obj);
}
if (obj instanceof Property) {
return LazyProperty.toString((Property) obj, "property");
}
if (obj instanceof MemgraphCypherResult) {
return memgraphCypherResultToString((MemgraphCypherResult) obj);
}
return InvokerHelper.toString(obj);
}
示例2: resultToString
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
public static String resultToString(Object obj) {
if (obj instanceof Vertex) {
return LazyVertex.toString((Vertex) obj);
}
if (obj instanceof Edge) {
return LazyEdge.toString((Edge) obj);
}
if (obj instanceof Property) {
return LazyProperty.toString((Property) obj, "property");
}
if (obj instanceof VertexiumCypherResult) {
return vertexiumCypherResultToString((VertexiumCypherResult) obj);
}
return InvokerHelper.toString(obj);
}
示例3: assertArrayEquals
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
/**
* Asserts that the arrays are equivalent and contain the same values
*
* @param expected
* @param value
*/
protected void assertArrayEquals(Object[] expected, Object[] value) {
String message =
"expected array: " + InvokerHelper.toString(expected) + " value array: " + InvokerHelper.toString(value);
assertNotNull(message + ": expected should not be null", expected);
assertNotNull(message + ": value should not be null", value);
assertEquals(message, expected.length, value.length);
for (int i = 0, size = expected.length; i < size; i++) {
assertEquals("value[" + i + "] when " + message, expected[i], value[i]);
}
}
示例4: createException
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
private static GroovyRuntimeException createException(String init, Constructor constructor, Object[] argumentArray, Throwable e, boolean setReason) {
return new GroovyRuntimeException(
init
+ constructor
+ " with arguments: "
+ InvokerHelper.toString(argumentArray)
+ " reason: "
+ e,
setReason ? e : null);
}
示例5: castToType
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
public static Object castToType(Object object, Class type) {
if (object == null) return null;
if (type == Object.class) return object;
final Class aClass = object.getClass();
if (type == aClass) return object;
if (type.isAssignableFrom(aClass)) return object;
if (ReflectionCache.isArray(type)) return asArray(object, type);
if (type.isEnum()) {
return ShortTypeHandling.castToEnum(object, type);
} else if (Collection.class.isAssignableFrom(type)) {
return continueCastOnCollection(object, type);
} else if (type == String.class) {
return InvokerHelper.toString(object);
} else if (type == Character.class) {
return ShortTypeHandling.castToChar(object);
} else if (type == Boolean.class) {
return castToBoolean(object);
} else if (type == Class.class) {
return ShortTypeHandling.castToClass(object);
} else if (type.isPrimitive()) {
return castToPrimitive(object, type);
}
return continueCastOnNumber(object, type);
}
示例6: checkParameters
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
/**
* Checks that the given parameters are valid to call this method
*
* @param arguments the arguments to check
* @throws IllegalArgumentException if the parameters are not valid
*/
public void checkParameters(Class[] arguments) {
// lets check that the argument types are valid
if (!isValidMethod(arguments)) {
throw new IllegalArgumentException(
"Parameters to method: "
+ getName()
+ " do not match types: "
+ InvokerHelper.toString(getParameterTypes())
+ " for arguments: "
+ InvokerHelper.toString(arguments));
}
}
示例7: toString
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
/**
* Returns a string representation of this method
*/
public String toString() {
return super.toString()
+ "[name: "
+ getName()
+ " params: "
+ InvokerHelper.toString(getParameterTypes())
+ " returns: "
+ getReturnType()
+ " owner: "
+ getDeclaringClass()
+ "]";
}
示例8: IncorrectClosureArgumentsException
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
public IncorrectClosureArgumentsException(Closure closure, Object arguments, Class[] expected) {
super(
"Incorrect arguments to closure: "
+ closure
+ ". Expected: "
+ InvokerHelper.toString(expected)
+ ", actual: "
+ InvokerHelper.toString(arguments));
this.closure = closure;
this.arguments = arguments;
this.expected = expected;
}
示例9: toString
import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
public String toString() {
return super.toString() + InvokerHelper.toString(parameters) + "{ " + code + " }";
}