本文整理汇总了Java中org.codehaus.jackson.node.JsonNodeFactory.instance方法的典型用法代码示例。如果您正苦于以下问题:Java JsonNodeFactory.instance方法的具体用法?Java JsonNodeFactory.instance怎么用?Java JsonNodeFactory.instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.node.JsonNodeFactory
的用法示例。
在下文中一共展示了JsonNodeFactory.instance方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAuthLinkResponse
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static String createAuthLinkResponse(){
JsonNodeFactory f = JsonNodeFactory.instance ;
ObjectNode loginResponse = f.objectNode();
loginResponse.put("text","Authorization for SkyGiraffe to use Slack details is required.");
ArrayNode attachments = loginResponse.putArray("attachments");
ObjectNode att = f.objectNode();
att.put("fallback", "Please authorize SkyGiraffe to access to your Slack details ...");
att.put("pretext", "");
att.put("title", "Please authorize..");
att.put("title_link", Config.getPropertyValue("SLACK_AUTH_URL_DEV"));
att.put("text","Once authorized and logged into SkyGiraffe try '/sg help' to see all commands");
att.put("color", "#7CD197");
attachments.add(att);
return loginResponse.toString();
}
示例2: createLoginLinkResponse
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* {
"attachments": [
{
"fallback": "Please login into SkyGiraffe to continue ...",
"pretext": "SkyGiraffe Login",
"title": "Please login into SkyGiraffe to continue ...",
"title_link": "https://sgbot-mobilityai.rhcloud.com/SGbot-1.0/skyg/login?key=",
"text": "Once logged in try '/sg help' to see all commands",
"color": "#7CD197"
}
]
}
* @return
*/
public static String createLoginLinkResponse(String slackUserId, String email, String teamId){
JsonNodeFactory f = JsonNodeFactory.instance ;
ObjectNode loginResponse = f.objectNode();
loginResponse.put("text","Login to SkyGiraffe is required.");
ArrayNode attachments = loginResponse.putArray("attachments");
ObjectNode att = f.objectNode();
att.put("fallback", "Please login into SkyGiraffe to continue ...");
att.put("pretext", "");
att.put("title", "Please login..");
att.put("title_link", Config.getPropertyValue("SGDS_LOGIN_URL_DEV")+slackUserId+"&EMAIL="+email+"&TEAMID="+teamId);
att.put("text","Once logged in try '/sg help' to see all commands");
att.put("color", "#7CD197");
attachments.add(att);
return loginResponse.toString();
}
示例3: main
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static void main(String[] args)
{
DependencyGraph g = new DependencyGraph();
JsonNodeFactory nc = JsonNodeFactory.instance;
JsonNode a = nc.numberNode(1);
JsonNode b = nc.numberNode(2);
JsonNode c = nc.numberNode(3);
JsonNode d = nc.numberNode(4);
JsonNode e = nc.numberNode(5);
JsonNode f = nc.numberNode(6);
JsonNode h = nc.numberNode(7);
JsonNode i = nc.numberNode(8);
g.addNode("input", null, a);
g.addNode("loaddict", null, b);
g.addNode("second", null, c);
g.addNode("encode", Arrays.asList(new String[] { "input", "loaddict" }), d);
g.addNode("groupby", Arrays.asList(new String[] { "encode" }), e);
g.addNode("filter", Arrays.asList(new String[] { "groupby" }), f);
g.addNode("join", Arrays.asList(new String[] { "filter", "second" }), h);
g.addNode("shuffle", Arrays.asList(new String[] { "join" }), i);
System.out.println(g.getSerialPlan());
}
示例4: createHashJoinOperator
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public HashJoinOperator createHashJoinOperator(BlockSchema lSchema,
BlockSchema rSchema,
BlockSchema operatorSchema,
TupleStore lStore,
TupleStore rStore) throws IOException, InterruptedException
{
/* Create Blocks */
final Block lBlock = new TupleStoreBlock(lStore, new BlockProperties(lBlockName, lSchema, (BlockProperties) null));
final Block rBlock = new TupleStoreBlock(rStore, new BlockProperties(rBlockName, rSchema, (BlockProperties) null));
/* Perform the Hash Join */
Map<String, Block> input = new HashMap<String, Block>();
input.put(lBlockName, lBlock);
input.put(rBlockName, rBlock);
ObjectNode root = new ObjectNode(JsonNodeFactory.instance);
root.put("leftBlock", lBlockName);
root.put("rightBlock", rBlockName);
final ArrayNode joinKeys = new ArrayNode(JsonNodeFactory.instance);
joinKeys.add("Integer");
root.put("leftJoinKeys", joinKeys);
root.put("rightJoinKeys", joinKeys);
BlockProperties props = new BlockProperties("Joined", operatorSchema, (BlockProperties) null);
HashJoinOperator operator = new HashJoinOperator();
operator.setInput(input, root, props);
return operator;
}
示例5: createOverrideStrategyField
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the override strategy field.
*
* @return the field
*/
private Field createOverrideStrategyField() {
List<String> overrideStrategySymbols = Arrays.asList(OverrideStrategy.APPEND.name(),
OverrideStrategy.REPLACE.name());
Schema overrideStrategyEnum = Schema.createEnum(OVERRIDE_STRATEGY_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, overrideStrategySymbols);
Field overrideStrategyField = new Field(OVERRIDE_STRATEGY, Schema.createUnion(Arrays.asList(
overrideStrategyEnum, Schema.create(Type.NULL))), null, null);
overrideStrategyField.addProp(DISPLAY_NAME, "Override strategy");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Append"));
displayNamesNode.add(TextNode.valueOf("Replace"));
overrideStrategyField.addProp(DISPLAY_NAMES, displayNamesNode);
overrideStrategyField.addProp(DISPLAY_PROMPT, "Select array override strategy");
return overrideStrategyField;
}
示例6: createClassTypeField
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the class type field.
*
* @return the field
*/
private Field createClassTypeField() {
List<String> classTypeSymbols = Arrays.asList(OBJECT, EVENT);
Schema classTypeEnum = Schema.createEnum(CLASS_TYPE_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, classTypeSymbols);
Field classTypeField = new Field(CLASS_TYPE, classTypeEnum, null, null);
classTypeField.addProp(DISPLAY_NAME, "Class type");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Object"));
displayNamesNode.add(TextNode.valueOf("Event"));
classTypeField.addProp(DISPLAY_NAMES, displayNamesNode);
classTypeField.addProp(DISPLAY_PROMPT, "Select class type");
classTypeField.addProp(BY_DEFAULT, OBJECT);
return classTypeField;
}
示例7: getParameterList
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public static String getParameterList(String sessionId, String appId, String repId, String repUpId) throws IOException {
//
if (sessionId == null || sessionId.isEmpty())
throw new IllegalArgumentException("Session Id is empty. Please login.");
HttpPost postRequest = new HttpPost("https://wspublisherv2https.skygiraffe.com/WSPublisherV2.svc/GetReport_ParametersMainScreen4");
// add header
postRequest.setHeader("Content-Type", "application/json");
JsonNodeFactory f = JsonNodeFactory.instance;
ObjectNode o = f.objectNode();
o.put("ApplicationID", appId);
o.put("ReportID", repId);
o.put("TabID","");
ArrayNode diuId = f.arrayNode();
diuId = o.putArray("DataItemUpdateIDs");
o.put("ReportUpdateID",repUpId);
o.put("RequestID",sessionId);
o.put("SessionID",sessionId);
StringEntity inputApps = new StringEntity(o.toString());
inputApps.setContentType("application/json");
postRequest.setEntity(inputApps);
CloseableHttpResponse responseParams = getHttpClient().execute(postRequest);
String paramStr = "";
try {
HttpEntity entityApps = responseParams.getEntity();
paramStr = EntityUtils.toString(entityApps, "UTF-8");
EntityUtils.consume(entityApps);
}finally{
responseParams.close();
}
logger.debug("Params = "+paramStr);
return paramStr;
}
示例8: BaseTO
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public BaseTO() {
super();
if (factory == null) {
factory = JsonNodeFactory.instance;
jsonMapper = new ObjectMapper();
}// EOF if
}
示例9: createBytesJsonValue
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
* Creates the bytes json value.
*
* @param value the value
* @return the array node
* @throws ParseException the parse exception
*/
private static ArrayNode createBytesJsonValue(String value) throws ParseException {
if (value != null) {
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode bytesNode = jsonFactory.arrayNode();
byte[] data = Base64Utils.fromBase64(value);
for (int i=0;i<data.length;i++) {
bytesNode.add(data[i]);
}
return bytesNode;
} else {
return null;
}
}
示例10: ObjectMapper
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
/**
*
* @param jf JsonFactory to use: if null, a new {@link MappingJsonFactory} will be constructed
* @param sp SerializerProvider to use: if null, a {@link StdSerializerProvider} will be constructed
* @param dp DeserializerProvider to use: if null, a {@link StdDeserializerProvider} will be constructed
* @param sconfig Serialization configuration to use; if null, basic {@link SerializationConfig}
* will be constructed
* @param dconfig Deserialization configuration to use; if null, basic {@link DeserializationConfig}
* will be constructed
*/
public ObjectMapper(JsonFactory jf,
SerializerProvider sp, DeserializerProvider dp,
SerializationConfig sconfig, DeserializationConfig dconfig)
{
/* 02-Mar-2009, tatu: Important: we MUST default to using
* the mapping factory, otherwise tree serialization will
* have problems with POJONodes.
* 03-Jan-2010, tatu: and obviously we also must pass 'this',
* to create actual linking.
*/
_jsonFactory = (jf == null) ? new MappingJsonFactory(this) : jf;
// visibility checker; usually default
_visibilityChecker = STD_VISIBILITY_CHECKER;
_serializationConfig = (sconfig != null) ? sconfig :
new SerializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, _visibilityChecker);
_deserializationConfig = (dconfig != null) ? dconfig :
new DeserializationConfig(DEFAULT_INTROSPECTOR, DEFAULT_ANNOTATION_INTROSPECTOR, _visibilityChecker);
_serializerProvider = (sp == null) ? new StdSerializerProvider() : sp;
_deserializerProvider = (dp == null) ? new StdDeserializerProvider() : dp;
// Default serializer factory is stateless, can just assign
_serializerFactory = BeanSerializerFactory.instance;
// and use standard JsonNodeFactory initially
_nodeFactory = JsonNodeFactory.instance;
}
示例11: newNode
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
protected ObjectNode newNode() {
return new ObjectNode(JsonNodeFactory.instance);
}
示例12: DeserializationConfig
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public DeserializationConfig(ClassIntrospector<? extends BeanDescription> paramClassIntrospector, AnnotationIntrospector paramAnnotationIntrospector, VisibilityChecker<?> paramVisibilityChecker, SubtypeResolver paramSubtypeResolver, PropertyNamingStrategy paramPropertyNamingStrategy, TypeFactory paramTypeFactory, HandlerInstantiator paramHandlerInstantiator)
{
super(paramClassIntrospector, paramAnnotationIntrospector, paramVisibilityChecker, paramSubtypeResolver, paramPropertyNamingStrategy, paramTypeFactory, paramHandlerInstantiator);
this._nodeFactory = JsonNodeFactory.instance;
}
示例13: DeserializationConfig
import org.codehaus.jackson.node.JsonNodeFactory; //导入方法依赖的package包/类
public DeserializationConfig(ClassIntrospector<? extends BeanDescription> paramClassIntrospector, AnnotationIntrospector paramAnnotationIntrospector, VisibilityChecker<?> paramVisibilityChecker, SubtypeResolver paramSubtypeResolver, PropertyNamingStrategy paramPropertyNamingStrategy, TypeFactory paramTypeFactory, HandlerInstantiator paramHandlerInstantiator)
{
super(paramClassIntrospector, paramAnnotationIntrospector, paramVisibilityChecker, paramSubtypeResolver, paramPropertyNamingStrategy, paramTypeFactory, paramHandlerInstantiator, collectFeatureDefaults(DeserializationConfig.Feature.class));
this._nodeFactory = JsonNodeFactory.instance;
}