public byte[] getNewRowFromDb() {
boolean isFirstElement = mainId == null;
Row row = inflateRow();
if (row != null) {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.getSerializationConfig().withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
mapper.setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.NONE);
mapper.setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(row);
json = isFirstElement ? "" + json : "," + json;
return json.getBytes();
} catch (Exception e) {
throw new AqlException("Failed to convert Aql Result to JSON", e);
}
}
return null;
}
java类org.codehaus.jackson.annotate.JsonMethod的实例源码
AqlJsonStreamer.java 文件源码
项目:artifactory
阅读 18
收藏 0
点赞 0
评论 0
VisibilityChecker.java 文件源码
项目:RHome
阅读 16
收藏 0
点赞 0
评论 0
public Std with(JsonAutoDetect ann)
{
if (ann == null) return this;
Std curr = this;
JsonMethod[] incl = ann.value();
Visibility v;
v = hasMethod(incl, JsonMethod.GETTER) ? ann.getterVisibility() : Visibility.NONE;
curr = curr.withGetterVisibility(v);
v = hasMethod(incl, JsonMethod.IS_GETTER) ? ann.isGetterVisibility() : Visibility.NONE;
curr = curr.withIsGetterVisibility(v);
v = hasMethod(incl, JsonMethod.SETTER) ? ann.setterVisibility() : Visibility.NONE;
curr = curr.withSetterVisibility(v);
v = hasMethod(incl, JsonMethod.CREATOR) ? ann.creatorVisibility() : Visibility.NONE;
curr = curr.withCreatorVisibility(v);
v = hasMethod(incl, JsonMethod.FIELD) ? ann.fieldVisibility() : Visibility.NONE;
curr = curr.withFieldVisibility(v);
return curr;
}
VisibilityChecker$Std.java 文件源码
项目:ingress-indonesia-dev
阅读 17
收藏 0
点赞 0
评论 0
private static boolean hasMethod(JsonMethod[] paramArrayOfJsonMethod, JsonMethod paramJsonMethod)
{
int i = paramArrayOfJsonMethod.length;
for (int j = 0; ; j++)
{
boolean bool = false;
if (j < i)
{
JsonMethod localJsonMethod = paramArrayOfJsonMethod[j];
if ((localJsonMethod == paramJsonMethod) || (localJsonMethod == JsonMethod.ALL))
bool = true;
}
else
{
return bool;
}
}
}
SlackAuthen.java 文件源码
项目:slack-rtm-api
阅读 29
收藏 0
点赞 0
评论 0
public SlackInfo tokenAuthen(String token, String proxyUrl, int proxyPort) {
HttpClient client = new HttpClient();
if (proxyUrl != null) {
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setProxyHost(new ProxyHost(proxyUrl, proxyPort));
client.setHostConfiguration(hostConfiguration);
}
GetMethod getMethod = new GetMethod(SLACK_RTM_AUTHEN_URL + token);
SlackInfo slackInfo = new SlackInfo();
try {
int httpStatus = client.executeMethod(getMethod);
if (httpStatus == HttpStatus.SC_OK) {
ObjectMapper mapper = new ObjectMapper().setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper.readValue(getMethod.getResponseBodyAsStream(), SlackInfo.class);
} else {
slackInfo.setError("http_status_" + httpStatus);
return slackInfo;
}
} catch (IOException ex) {
slackInfo.setError("exception " + ex.getMessage());
Logger.getLogger(SlackAuthen.class.getName()).log(Level.SEVERE, null, ex);
} finally {
getMethod.releaseConnection();
}
return slackInfo;
}
AqlJsonStreamer.java 文件源码
项目:artifactory
阅读 19
收藏 0
点赞 0
评论 0
private String generateRangeJson() throws IOException {
Range range = new Range(offset, rowsCount, rowsCount, limit);
ObjectMapper mapper = new ObjectMapper();
mapper.getSerializationConfig().withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
mapper.setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.NONE);
mapper.setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(range);
}
VisibilityChecker.java 文件源码
项目:12306-android-Decompile
阅读 23
收藏 0
点赞 0
评论 0
private static boolean hasMethod(JsonMethod[] paramArrayOfJsonMethod, JsonMethod paramJsonMethod)
{
int i = paramArrayOfJsonMethod.length;
for (int j = 0; j < i; j++)
{
JsonMethod localJsonMethod = paramArrayOfJsonMethod[j];
if ((localJsonMethod == paramJsonMethod) || (localJsonMethod == JsonMethod.ALL))
return true;
}
return false;
}
VisibilityChecker.java 文件源码
项目:RHome
阅读 21
收藏 0
点赞 0
评论 0
/**
* Constructor used for building instance that has minumum visibility
* levels as indicated by given annotation instance
*
* @param ann Annotations to use for determining minimum visibility levels
*/
public Std(JsonAutoDetect ann)
{
JsonMethod[] incl = ann.value();
// let's combine checks for enabled/disabled, with minimimum level checks:
_getterMinLevel = hasMethod(incl, JsonMethod.GETTER) ? ann.getterVisibility() : Visibility.NONE;
_isGetterMinLevel = hasMethod(incl, JsonMethod.IS_GETTER) ? ann.isGetterVisibility() : Visibility.NONE;
_setterMinLevel = hasMethod(incl, JsonMethod.SETTER) ? ann.setterVisibility() : Visibility.NONE;
_creatorMinLevel = hasMethod(incl, JsonMethod.CREATOR) ? ann.creatorVisibility() : Visibility.NONE;
_fieldMinLevel = hasMethod(incl, JsonMethod.FIELD) ? ann.fieldVisibility() : Visibility.NONE;
}
VisibilityChecker.java 文件源码
项目:RHome
阅读 21
收藏 0
点赞 0
评论 0
private static boolean hasMethod(JsonMethod[] methods, JsonMethod method)
{
for (JsonMethod curr : methods) {
if (curr == method || curr == JsonMethod.ALL) return true;
}
return false;
}
VisibilityChecker.java 文件源码
项目:12306-android-Decompile
阅读 16
收藏 0
点赞 0
评论 0
private static boolean hasMethod(JsonMethod[] paramArrayOfJsonMethod, JsonMethod paramJsonMethod)
{
int i = paramArrayOfJsonMethod.length;
for (int j = 0; j < i; j++)
{
JsonMethod localJsonMethod = paramArrayOfJsonMethod[j];
if ((localJsonMethod == paramJsonMethod) || (localJsonMethod == JsonMethod.ALL))
return true;
}
return false;
}
DefaultObjectMapper.java 文件源码
项目:jersey-jump
阅读 17
收藏 0
点赞 0
评论 0
public DefaultObjectMapper() {
configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
setSerializationInclusion(JsonSerialize.Inclusion.ALWAYS);
configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.PUBLIC_ONLY);
}
ScoopClient.java 文件源码
项目:Scoopit-Java
阅读 17
收藏 0
点赞 0
评论 0
public ScoopClient(String apiKey, String apiSecret) {
client = new ServiceBuilder().provider(ScoopApi.class).apiKey(apiKey)
.apiSecret(apiSecret).build();
mapper = new ObjectMapper();
mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
mapper.configure(
DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
}
JsonMarshaller.java 文件源码
项目:spring-data-simpledb
阅读 20
收藏 0
点赞 0
评论 0
public <T> String marshall(T input) {
Assert.notNull(input);
jsonMapper = new ObjectMapper().setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
jsonMapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL, "@class");
try {
return jsonMapper.writeValueAsString(input);
} catch(Exception e) {
throw new MappingException(e.getMessage(), e);
}
}
ObjectMapperFactory.java 文件源码
项目:apex-core
阅读 17
收藏 0
点赞 0
评论 0
@Override
public VC withVisibility(JsonMethod method, Visibility v)
{
return this;
}
Store.java 文件源码
项目:visual-scripting
阅读 25
收藏 0
点赞 0
评论 0
public static ObjectMapper createMapper() {
ObjectMapper mapper = new ObjectMapper();
for (Map.Entry<JsonMethod, JsonAutoDetect.Visibility> entry : VISIBILITIES.entrySet()) {
mapper.setVisibility(entry.getKey(), entry.getValue());
}
return mapper;
}