User user = inputJSONObjectMapper.readValue(jsonOfUser, User.class);
):private class User {
private String name;
private String familyname;
private int age;
private Map<String, Object> address;
private String[] roles;
@SuppressWarnings("unused")
public String getFamilyname() {
return familyname;
}
@SuppressWarnings("unused")
public void setFamilyname(String data) {
this.familyname = data;
}
public String getName() {
return name;
}
@SuppressWarnings("unused")
public void setName(String data) {
this.name = data;
}
@SuppressWarnings("unused")
public int getAge() {
return age;
}
@SuppressWarnings("unused")
public void setAge(int data) {
this.age = data;
}
public Map<String, Object> getAddress() {
return address;
}
@SuppressWarnings("unused")
public void setAddress(Map<String, Object> data) {
this.address = data;
}
public String[] getRoles() {
return roles;
}
@SuppressWarnings("unused")
public void setRoles(String[] data) {
this.roles = data;
}
@SuppressWarnings("unused")
// default constructor needed for jackson
public User() {
}
public User(String name, String familyname, int age,
Map<String, Object> address, String[] roles) {
super();
this.name = name;
this.familyname = familyname;
this.age = age;
this.address = address;
this.roles = roles;
}
}
com.fasterxml.jackson.databind.ObjectMapper.ObjectMapper inputJSONObjectMapper = new ObjectMapper();
// @formatter:off
String jsonOfUser = "{" +
" \"name\": \"Test User\"," +
" \"age\": 30," +
" \"address\": {" +
" \"line1\": \"My Address Line 1\"," +
" \"line2\": null," +
" \"city\": \"Washington D.C.\"" +
" \"zip\": 20000" +
"}," +
"\"roles\": [" +
" \"User\"," +
" \"Editor\"" +
"]" +
"};";
// @formatter:on
User user = inputJSONObjectMapper.readValue(jsonOfUser, User.class);
Map<String, Object>
-
и version
и java вам вернет инфломацию о своей версии.sysdm.cpl
~\AppData\Local\JetBrains\PyCharm Community Edition 5.0.6
08/28/2019 10:38 PM <DIR> .
08/28/2019 10:38 PM <DIR> ..
08/28/2019 10:38 PM <DIR> bin
10/18/2016 02:48 PM 13 build.txt
08/28/2019 10:37 PM <DIR> help
08/28/2019 10:37 PM <DIR> helpers
08/28/2019 10:38 PM <DIR> jre
08/28/2019 10:38 PM <DIR> lib
08/28/2019 10:38 PM <DIR> license
08/28/2019 10:38 PM <DIR> plugins
08/28/2019 10:38 PM <DIR> skeletons
Directory of C:\Users\sergueik\AppData\Local\JetBrains\PyCharm Community Editio
n 5.0.6\jre\jre\bin
08/28/2019 10:38 PM <DIR> .
08/28/2019 10:38 PM <DIR> ..
04/07/2016 06:45 AM 19,488 attach.dll
04/07/2016 06:45 AM 1,182,240 awt.dll
04/07/2016 06:45 AM 15,392 bci.dll
pushd C:\Users\sergueik\AppData\Local\JetBrains\PyCharm Community Edition 5.0.6
set java_home=%CD%\JRE\jre
path=%JAVA_HOME%\BIN;%path%
C:\Users\sergueik\AppData\Local\JetBrains\PyCharm Community Edition 5.0.6>java -
version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) Client VM (build 25.77-b03, mixed mode)
<!-- Copyright (c) Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.1.0.0"
processorArchitecture="x86"
name="Microsoft.Windows.FileSystem.Tree"
type="win32"
/>
<description>Tree Walk Utility</description>
...
Failed to press 60 Unknown keyCode: 0x3c
// Failed to press 91 Open Bracket
// Failed to press 93 Close Bracket
// Failed to press 44 Comma
// Failed to press 47 Slash
@Test
public void writeStringTest(){
writeString("Hello AWT!");
robot.keyPress(KeyEvent.VK_ENTER);
writeString(
",-./0123456789;=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz[\\]0123456789*+-./");
robot.keyPress(KeyEvent.VK_ENTER);
}
@Test
public void writeStringTest() {
writeString("Hello AWT!");
robot.keyPress(KeyEvent.VK_ENTER);
writeString(
",-./0123456789;=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz[\\]0123456789*+-./");
}
private void writeString(String s) {
for (int code = 0; code < s.length(); code++) {
char _char = s.charAt(code);
if (Character.isUpperCase(_char)) {
robot.keyPress(KeyEvent.VK_SHIFT);
}
try {
robot.keyPress(Character.toUpperCase(_char));
robot.keyRelease(Character.toUpperCase(_char));
} catch (IllegalArgumentException e) {
System.err.println("Failed to press " + KeyEvent.getKeyText(code));
//
}
if (Character.isUpperCase(_char)) {
robot.keyRelease(KeyEvent.VK_SHIFT);
}
}
robot.delay(delay);
}
-.0123456789=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯфисвуапршолдьтщзйкыегмцчня\0123456789-.
"./0123456789;=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz[\\]0123456789*+-./<code>
,-./0123456789;=ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]0123456789*+-./
не специальные - трудно поверить в ваш сценарий на windows 8 печатает без проблем. java.awt.Robot
- уж очень он дряхлый.
driver.Close()
иdriver.Quit()
?