public Application(PippoSettings settings) { this.pippoSettings = settings; this.languages = new Languages(settings); this.messages = new Messages(languages); this.mimeTypes = new MimeTypes(settings); this.httpCacheToolkit = new HttpCacheToolkit(settings); this.engines = new ContentTypeEngines(); this.initializers = new ArrayList<>(); this.webSocketRouter = new WebSocketRouter(); registerContentTypeEngine(TextPlainEngine.class); }
@AfterMethod public void tearDown(ITestResult result) { new Messages().screenshot(result); }
@Path("rest/heartbeat") public class HeartbeatResource { @GET @Produces(MediaType.APPLICATION_XML) public Response heartbeatGet() { return Response.status(Status.OK).type(MediaType.APPLICATION_XML) .entity(new Messages("I am alive!")).build(); } }
var messages = new Messages(); for(var i = 0; i < 3; ++i){
public static void main(String[] args) { Messages m = new Messages(); String jsonMessage = getJsonMessage(); // This gets the JSON message to be run through ObjectMapper ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); /* this is the fix */ try { Message message = mapper.readValue(jsonMessage, Message.class); } catch (Exception e) { e.printStackTrace(); } } // end method main()
public class MessageAdapter extends XmlAdapter<Messages,Map<String, Message>> { @Override public Map<String, Message> unmarshal( Messages value ){ Map<String, Message> map = new HashMap<String, Message>(); for( Message msg : value.messages ) map.put( msg.getId(), msg ); return map; } @Override public Messages marshal( Map<String, Message> map ){ Messages msgCont = new Messages(); Collection<Message> msgs = map.values(); msgCont.messages = msgs.toArray(new Message[msgs.size()]); return msgCont; } }
Messages messages = new Messages(); messages.setMessage("Some message here"); //Add all the regn IDs to the regIDs List. ArrayList<String> regIDs = messages.getRegIDs() regIDs.add("regnID1"); regIDs.add("regnID2"); regIDs.add("regnID3"); regIDs.add("regnID4"); //Add as many IDs as you want. //then create a new GSON Object. Gson gson = new Gson(); String jsonString = gson.toJSON(messages);
Bundle in = getIntent().getExtras(); if(in!=null){ str = in.getString("METHOD"); if(str.equals("getMessage")==true){ Log.d("tag Message","lanuch get message fragment"); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); getSlidingMenu().toggle(); getSupportActionBar().setTitle("Messages"); Messages msg=new Messages(); ft.replace(R.id.details, msg); ft.addToBackStack(null); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } if(str.equals("getAnecMessage")==true){ Log.d("tag Notification", "launch getanec message activity") ; NotificationAdapter adapter=new NotificationAdapter(MainActivity.this, notification_data); if (adapter!=null) { list=(ListView)slidingMenu.findViewById(R.id.list_notification_menu); list.setAdapter(adapter); } }
Messages messages = new Messages(); fragmentTransaction.replace(R.id.fragmentHolder,messages).commit();
Messages messages = new Messages(); getSupportFragmentManager().beginTransaction().replace(R.id.fragmentHolder,messages).commit();