@Override public String toString() { return this.annotation.toString(); } }
@Override public String toString() { return annotation.toString(); } }
@Override public String toString() { return annotation.toString(); } }
public String toString() { return core.toString(); }
@Override public String toString() { String annotationString = annotation.toString(); // Show @Provides w/o the com.google.inject prefix. if (annotation.annotationType() == Provides.class) { annotationString = "@Provides"; } else if (annotationString.endsWith("()")) { // Remove the common "()" suffix if there are no values. annotationString = annotationString.substring(0, annotationString.length() - 2); } return annotationString + " " + StackTraceElements.forMember(method); }
public String format(Annotation[] as) { List<String> names = new ArrayList<String>(); for (Annotation f : as) { names.add(f.toString()); } return sortAndPrintNames(names); }
private String printAnnotation(Annotation a) { return a.toString(); // StringBuilder buf = new StringBuilder(); // printAnnotationHelper(buf,a); // return buf.toString(); }
public Script(Annotation annotation, String engine, String source, String reason) { this(Preconditions.notNull(annotation, "annotation must not be null").annotationType(), annotation.toString(), engine, source, reason); }
public final String toString() { return getAnnotation().toString(); } }
String getAnnotationName() { Annotation annotation = annotationStrategy.getAnnotation(); if (annotation != null) { return annotation.toString(); } // not test-covered return annotationStrategy.getAnnotationType().toString(); }
char[] buffer = new char[MAX_TITLE_LENGTH * 2]; GetWindowTextW(GetForegroundWindow(), buffer, MAX_TITLE_LENGTH); System.out.println("Active window title: " + Native.toString(buffer)); Pointer process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pointer.getValue()); GetModuleBaseNameW(process, null, buffer, MAX_TITLE_LENGTH); System.out.println("Active window process: " + Native.toString(buffer));
import com.sun.jna.Native; import com.sun.jna.platform.win32.*; import com.sun.jna.win32.W32APIOptions; public class ProcessList { public static void main(String[] args) { WinNT winNT = (WinNT) Native.loadLibrary(WinNT.class, W32APIOptions.UNICODE_OPTIONS); WinNT.HANDLE snapshot = winNT.CreateToolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS, new WinDef.DWORD(0)); Tlhelp32.PROCESSENTRY32.ByReference processEntry = new Tlhelp32.PROCESSENTRY32.ByReference(); while (winNT.Process32Next(snapshot, processEntry)) { System.out.println(processEntry.th32ProcessID + "\t" + Native.toString(processEntry.szExeFile)); } winNT.CloseHandle(snapshot); } }
/** * Returns the name the binding should use. This is based on the annotation. If the annotation has * an instance and is not a marker annotation, we ask the annotation for its toString. If it was a * marker annotation or just an annotation type, we use the annotation's name. Otherwise, the name * is the empty string. */ public static String nameOf(Key<?> key) { Annotation annotation = key.getAnnotation(); Class<? extends Annotation> annotationType = key.getAnnotationType(); if (annotation != null && !isMarker(annotationType)) { return key.getAnnotation().toString(); } else if (key.getAnnotationType() != null) { return "@" + key.getAnnotationType().getName(); } else { return ""; } } }
byte[] buffer = new byte[1024]; User32.instance.GetWindowTextA(hWnd, buffer, buffer.length); String title = Native.toString(buffer); inflList.add(new WindowInfo(hWnd, r, title));
for (Annotation a : invocable.getHandlingMethod().getDeclaredAnnotations()) { if (null != a.annotationType().getAnnotation(HttpMethod.class)) { httpMethodAnnotations.add(a.toString());
for (Annotation a : invocable.getHandlingMethod().getDeclaredAnnotations()) { if (null != a.annotationType().getAnnotation(HttpMethod.class)) { httpMethodAnnotations.add(a.toString());
/** * Testing that type level annotations are copied to the executor. This loads a different form of the type with a * second annotation. */ @Test public void typeLevelAnnotations2() { String t = "executor.A"; TypeRegistry typeRegistry = getTypeRegistry(t); ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t)); rtype.loadNewVersion("2", retrieveRename(t, t + "2")); Class<?> clazz = rtype.getLatestExecutorClass(); Assert.assertEquals(Utils.getExecutorName(t, "2"), clazz.getName()); Annotation[] annos = clazz.getAnnotations(); Assert.assertNotNull(annos); Assert.assertEquals(2, annos.length); Set<String> s = new HashSet<String>(); for (Annotation anno : annos) { s.add(anno.toString()); } Assert.assertTrue(s.remove("@common.Marker()")); // Allow for alternate toString() variant if (!s.remove("@common.Anno(someValue=37, longValue=2, id=abc)")) { Assert.assertTrue(s.remove("@common.Anno(longValue=2, someValue=37, id=abc)")); } Assert.assertEquals(0, s.size()); }
@Test public void methodLevelAnnotationsOnInterfaces2() throws Exception { String t = "reflection.methodannotations.InterfaceTarget"; TypeRegistry typeRegistry = getTypeRegistry(t); ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t)); checkAnnotations(rtype.bytesLoaded, "privMethod()V", "@reflection.AnnoT3(value=Foo)"); reload(rtype, "37"); checkAnnotations(rtype.getLatestExecutorBytes(), "privMethod(Lreflection/methodannotations/InterfaceTarget;)V", "@reflection.AnnoT3(value=Foo)"); rtype.loadNewVersion("39", retrieveRename(t, t + "002")); checkAnnotations(rtype.getLatestExecutorBytes(), "privMethod(Lreflection/methodannotations/InterfaceTarget;)V", "@reflection.AnnoT3(value=Bar)"); Method m = rtype.getLatestExecutorClass().getDeclaredMethod("privMethod", rtype.getClazz()); assertEquals("@reflection.AnnoT3(value=Bar)", m.getAnnotations()[0].toString()); }
@Test public void methodLevelAnnotationsOnInterfaces() throws Exception { String t = "executor.I"; TypeRegistry typeRegistry = getTypeRegistry(t); ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t)); reload(rtype, "37"); checkAnnotations(rtype.bytesLoaded, "m()V", "@common.Marker()"); checkAnnotations(rtype.bytesLoaded, "m2()V"); checkAnnotations(rtype.getLatestExecutorBytes(), "m(Lexecutor/I;)V", "@common.Marker()"); checkAnnotations(rtype.getLatestExecutorBytes(), "m2(Lexecutor/I;)V"); rtype.loadNewVersion("39", retrieveRename("executor.I", "executor.I2")); checkAnnotations(rtype.getLatestExecutorBytes(), "m(Lexecutor/I;)V"); checkAnnotations(rtype.getLatestExecutorBytes(), "m2(Lexecutor/I;)V", "@common.Marker()", "@common.Anno(id=abc)"); Method m = rtype.getLatestExecutorClass().getDeclaredMethod("m2", rtype.getClazz()); assertEquals("@common.Marker()", m.getAnnotations()[0].toString()); assertIsOneOfThese(printAnnotation(m.getAnnotations()[1]), "@common.Anno(someValue=37, longValue=2, id=abc)", "@common.Anno(longValue=2, someValue=37, id=abc)"); }
String getAnnotationName() { Annotation annotation = annotationStrategy.getAnnotation(); if (annotation != null) { return annotation.toString(); } // not test-covered return annotationStrategy.getAnnotationType().toString(); }