public MetaMethod(Method method, MetaClass methodClass) { super(method.getName()); this.methodToString = method.toString(); this.metaClass = methodClass; returnType = method.getReturnType(); paramTypes = Arrays.asList(method.getParameterTypes()); // Can include non-method modifiers such as volatile so AND with // acceptable values modifier = method.getModifiers() & Modifier.methodModifiers(); isVarArgs = method.isVarArgs(); checkPolymorphicSignature(method); if (DEBUG_MEMBER_CREATION) { logger.debug("Created MetaMethod: {}", toString()); } }
public MetaMethod(Method method, MetaClass methodClass) { super(method.getName()); this.methodToString = method.toString(); this.metaClass = methodClass; returnType = method.getReturnType(); paramTypes = Arrays.asList(method.getParameterTypes()); // Can include non-method modifiers such as volatile so AND with // acceptable values modifier = method.getModifiers() & Modifier.methodModifiers(); isVarArgs = method.isVarArgs(); checkPolymorphicSignature(method); if (DEBUG_MEMBER_CREATION) { logger.debug("Created MetaMethod: {}", toString()); } }
public HelperMetaMethod(String methodName, MetaClass metaClass, Class<?>[] params, Class<?> returnType) throws NoSuchMethodException, SecurityException { super(methodName); Method dummyMethodObject = java.lang.String.class.getDeclaredMethod("length", new Class<?>[0]); this.metaClass = metaClass; this.returnType = returnType; this.paramTypes = Arrays.asList(params); // Can include non-method modifiers such as volatile so AND with // acceptable values this.modifier = dummyMethodObject.getModifiers() & Modifier.methodModifiers(); this.isVarArgs = dummyMethodObject.isVarArgs(); checkPolymorphicSignature(dummyMethodObject); metaClass.addMember(this); if (DEBUG_MEMBER_CREATION) { logger.debug("Created HelperMetaMethod: {}", toString()); } }
private void doAssertHasMethods(AssertionInfo info, Class<?> actual, Set<Method> actualMethods, boolean declared, String... expectedMethods) { SortedSet<String> expectedMethodNames = newTreeSet(expectedMethods); SortedSet<String> missingMethodNames = newTreeSet(); SortedSet<String> actualMethodNames = methodsToName(actualMethods); if (expectedMethods.length == 0) { if (actualMethods.isEmpty()) return; throw failures.failure(info, shouldNotHaveMethods(actual, declared, getMethodsWithModifier(actualMethods, Modifier.methodModifiers()))); } if (!noMissingElement(actualMethodNames, expectedMethodNames, missingMethodNames)) { throw failures.failure(info, shouldHaveMethods(actual, declared, expectedMethodNames, missingMethodNames)); } }
private void doAssertHasMethods(AssertionInfo info, Class<?> actual, Set<Method> actualMethods, boolean declared, String... expectedMethods) { SortedSet<String> expectedMethodNames = newTreeSet(expectedMethods); SortedSet<String> missingMethodNames = newTreeSet(); SortedSet<String> actualMethodNames = methodsToName(actualMethods); if (expectedMethods.length == 0) { if (actualMethods.isEmpty()) return; throw failures.failure(info, shouldNotHaveMethods(actual, declared, getMethodsWithModifier(actualMethods, Modifier.methodModifiers()))); } if (!noMissingElement(actualMethodNames, expectedMethodNames, missingMethodNames)) { throw failures.failure(info, shouldHaveMethods(actual, declared, expectedMethodNames, missingMethodNames)); } }
Modifier.toString(m.getModifiers()&Modifier.methodModifiers())
public MethodBuilder defineMethod( final String name, final int modifiers, final Type<?> returnType, final TypeList parameterTypes, final TypeList thrownTypes) { return defineMethodCore( name, modifiers & Modifier.methodModifiers(), returnType, parameterTypes, thrownTypes ); }
public MethodBuilder defineMethod( final String name, final int modifiers, final Type<?> returnType, final TypeList parameterTypes, final TypeList thrownTypes) { return defineMethodCore( name, modifiers & Modifier.methodModifiers(), returnType, parameterTypes, thrownTypes ); }
public MethodBuilder defineMethod( final String name, final int modifiers, final Type<?> returnType, final TypeList parameterTypes, final TypeList thrownTypes) { return defineMethodCore( name, modifiers & Modifier.methodModifiers(), returnType, parameterTypes, thrownTypes ); }
public String toString(Method m) { try { StringBuilder sb = new StringBuilder(); int mod = m.getModifiers() & java.lang.reflect.Modifier.methodModifiers(); if (mod != 0) { sb.append(java.lang.reflect.Modifier.toString(mod)).append(' '); } sb.append(m.getReturnType()).append(' '); sb.append(m.getName()).append('('); Class<?>[] params = m.getParameterTypes(); for (int j = 0; j < params.length; j++) { sb.append(params[j].toString()); if (j < (params.length - 1)) sb.append(','); } sb.append(')'); return sb.toString(); } catch (Exception e) { return "<" + e + ">"; } }
public String toString(Method m) { try { StringBuilder sb = new StringBuilder(); int mod = m.getModifiers() & java.lang.reflect.Modifier.methodModifiers(); if (mod != 0) { sb.append(java.lang.reflect.Modifier.toString(mod)).append(' '); } sb.append(m.getReturnType()).append(' '); sb.append(m.getName()).append('('); Class<?>[] params = m.getParameterTypes(); for (int j = 0; j < params.length; j++) { sb.append(params[j].toString()); if (j < (params.length - 1)) sb.append(','); } sb.append(')'); return sb.toString(); } catch (Exception e) { return "<" + e + ">"; } }
public static String getModifier(Method m) { return getModifier(Modifier.methodModifiers(), m.getModifiers(), m.isDefault()); }
int mod = method.getModifiers() & Modifier.methodModifiers(); if (mod != 0)
public MethodCode newMethod(int access, String methodName, MethodTypeDescriptor methodDescriptor, String signature, String[] exceptions) { if ((access & ~Modifier.methodModifiers()) != 0) { throw new IllegalArgumentException(); } methodCount += 1; return new MethodCode(this, access, methodName, methodDescriptor, classWriter.visitMethod(access, methodName, methodDescriptor.descriptor(), signature, exceptions)); }
try { StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { sb.append(Modifier.toString(mod)).append(' ');
try { StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { sb.append(Modifier.toString(mod)).append(' ');
try { StringBuilder sb = new StringBuilder(); int mod = method.getModifiers() & Modifier.methodModifiers(); if (mod != 0) { sb.append(Modifier.toString(mod)).append(' ');
try { StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { sb.append(Modifier.toString(mod)).append(' ');
try { StringBuilder sb = new StringBuilder(); int mod = getModifiers() & Modifier.methodModifiers(); if (mod != 0) { sb.append(Modifier.toString(mod)).append(' ');