List of usage examples for java.lang Object Object
@HotSpotIntrinsicCandidate
public Object()
From source file:Snippet178.java
static void hookApplicationMenu(Display display, final String aboutName) { // Callback target Object target = new Object() { int commandProc(int nextHandler, int theEvent, int userData) { if (OS.GetEventKind(theEvent) == OS.kEventProcessCommand) { HICommand command = new HICommand(); OS.GetEventParameter(theEvent, OS.kEventParamDirectObject, OS.typeHICommand, null, HICommand.sizeof, null, command); switch (command.commandID) { case kHICommandPreferences: return handleCommand("Preferences"); //$NON-NLS-1$ case kHICommandAbout: return handleCommand(aboutName); default: break; }/*from w ww. j av a2 s . c o m*/ } return OS.eventNotHandledErr; } int handleCommand(String command) { Shell shell = new Shell(); MessageBox preferences = new MessageBox(shell, SWT.ICON_WARNING); preferences.setText(command); preferences.open(); shell.dispose(); return OS.noErr; } }; final Callback commandCallback = new Callback(target, "commandProc", 3); //$NON-NLS-1$ int commandProc = commandCallback.getAddress(); if (commandProc == 0) { commandCallback.dispose(); return; // give up } // Install event handler for commands int[] mask = new int[] { OS.kEventClassCommand, OS.kEventProcessCommand }; OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, mask.length / 2, mask, 0, null); // create About ... menu command int[] outMenu = new int[1]; short[] outIndex = new short[1]; if (OS.GetIndMenuItemWithCommandID(0, kHICommandPreferences, 1, outMenu, outIndex) == OS.noErr && outMenu[0] != 0) { int menu = outMenu[0]; int l = aboutName.length(); char buffer[] = new char[l]; aboutName.getChars(0, l, buffer, 0); int str = OS.CFStringCreateWithCharacters(OS.kCFAllocatorDefault, buffer, l); OS.InsertMenuItemTextWithCFString(menu, str, (short) 0, 0, kHICommandAbout); OS.CFRelease(str); // add separator between About & Preferences OS.InsertMenuItemTextWithCFString(menu, 0, (short) 1, OS.kMenuItemAttrSeparator, 0); // enable pref menu OS.EnableMenuCommand(menu, kHICommandPreferences); // disable services menu OS.DisableMenuCommand(menu, kHICommandServices); } // schedule disposal of callback object display.disposeExec(new Runnable() { public void run() { commandCallback.dispose(); } }); }
From source file:com.job.portal.dao.JobApplicationsDAO.java
public boolean applyForJob(String jobId, String userId) { boolean flag = false; try {/*from w w w . ja v a 2 s . c om*/ String sql = "insert into job_applications (appliedOn,jobId,userId) " + "values (?,?,?)"; Object arr[] = new Object[3]; arr[0] = new Date(); arr[1] = jobId; arr[2] = userId; int id = insert(sql, arr); if (id > -1) { flag = true; } } catch (Exception e) { LogOut.log.error("In " + new Object() { }.getClass().getEnclosingClass().getName() + "." + new Object() { }.getClass().getEnclosingMethod().getName() + " " + e); } finally { return flag; } }
From source file:nl.mok.mastersofcode.spectatorclient.controllers.TeamController.java
@RequestMapping(method = RequestMethod.GET, value = "/{username}") public ModelAndView showTeam(final HttpServletRequest request, @PathVariable String username) { ModelAndView mav = new ModelAndView(); mav.addObject("page", new Object() { public String uri = "/spec/team"; public String redirect = request.getRequestURL().toString(); });/*from w ww .j av a 2 s .com*/ mav.addObject("team", DataController.getTeamById(username).orElse(null)); mav.addObject("currentCompetition", DataController.getCurrentCompetition()); mav.addObject("currentRound", DataController.getCurrentRound()); mav.setViewName("team.twig"); return mav; }
From source file:me.ferrybig.javacoding.webmapper.test.session.DefaultDataStorageTest.java
@Test public void setAndGetDataTest() { data.setData(Collections.emptyList()); assertEquals(0, data.getData().size()); data.setData(Collections.singleton(new Object())); assertEquals(1, data.getData().size()); }
From source file:nl.mok.mastersofcode.spectatorclient.controllers.CompetitionController.java
@RequestMapping(method = RequestMethod.GET, value = "/{id}") public ModelAndView showCompetition(final HttpServletRequest request, @PathVariable int id) { ModelAndView mav = new ModelAndView(); mav.addObject("page", new Object() { public String uri = "/spec/competition/" + id; public String redirect = request.getRequestURL().toString(); });/* w w w .j a v a2 s. com*/ mav.addObject("competition", DataController.getCompetitionById(id).orElse(null)); mav.addObject("currentCompetition", DataController.getCurrentCompetition()); mav.addObject("currentRound", DataController.getCurrentRound()); mav.setViewName("competition.twig"); return mav; }
From source file:net.paulgray.bbrest.web.ConfigController.java
@RequestMapping(value = "/info", method = RequestMethod.GET) public ResponseEntity configView() { final SystemInfoService bbInfo = SystemInfoServiceFactory.getInstance(); return new ResponseEntity(new Object() { public JvmInfo jvmInfo = bbInfo.getJvmInfo(); public OsInfo osInfo = bbInfo.getOsInfo(); public String app = "BbRest"; public String version = "1.0.0-SNAPSHOT"; public Date time = new Date(); }, HttpStatus.OK);/*from w w w. j a v a2 s . c o m*/ }
From source file:org.springextensions.db4o.EmbeddedClientServerIT.java
@Test public void testObjectContainer() { Assert.assertNotNull(objectContainer); Assert.assertNotNull(db4oOperations); Object object = new Object(); db4oOperations.store(object);//from w w w .ja v a 2s. c om }
From source file:com.google.gwt.emultest.java.util.HashSetTest.java
public void testAddingKeys() { Map<Object, Object> map = new HashMap<Object, Object>(); Set<Object> keys = new HashSet<Object>(map.keySet()); keys.add(new Object()); // Throws exception in IE6 (web-mode) but not GWT }
From source file:kr.okplace.job.common.InfiniteLoopReader.java
public Object read() throws Exception, UnexpectedInputException, ParseException { return new Object(); }
From source file:com.link_intersystems.lang.PrimitiveArrayCallbackTest.java
@Test(expected = IllegalArgumentException.class) public void notAnArrayConstructorArg() { new PrimitiveArrayCallback(new Object()); }