本文整理汇总了Java中com.fasterxml.jackson.core.PrettyPrinter类的典型用法代码示例。如果您正苦于以下问题:Java PrettyPrinter类的具体用法?Java PrettyPrinter怎么用?Java PrettyPrinter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrettyPrinter类属于com.fasterxml.jackson.core包,在下文中一共展示了PrettyPrinter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public void testPrettyPrinter() throws Exception
{
PrettyPrinter p = new DefaultPrettyPrinter();
byte[] stuff = jdkSerialize(p);
PrettyPrinter back = jdkDeserialize(stuff);
// what should we test?
assertNotNull(back);
}
示例2: ObjectWriter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
protected ObjectWriter(ObjectMapper paramObjectMapper, SerializationConfig paramSerializationConfig, JavaType paramJavaType, PrettyPrinter paramPrettyPrinter)
{
this._config = paramSerializationConfig;
this._serializerProvider = paramObjectMapper._serializerProvider;
this._serializerFactory = paramObjectMapper._serializerFactory;
this._jsonFactory = paramObjectMapper._jsonFactory;
if (paramJavaType != null)
paramJavaType = paramJavaType.withStaticTyping();
this._rootType = paramJavaType;
this._prettyPrinter = paramPrettyPrinter;
this._schema = null;
this._rootSerializer = _prefetchRootSerializer(paramSerializationConfig, paramJavaType);
}
示例3: with
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public ObjectWriter with(PrettyPrinter paramPrettyPrinter)
{
if (paramPrettyPrinter == this._prettyPrinter)
return this;
if (paramPrettyPrinter == null)
paramPrettyPrinter = NULL_PRETTY_PRINTER;
SerializationConfig localSerializationConfig = this._config;
JavaType localJavaType = this._rootType;
JsonSerializer localJsonSerializer = this._rootSerializer;
FormatSchema localFormatSchema = this._schema;
return new ObjectWriter(this, localSerializationConfig, localJavaType, localJsonSerializer, paramPrettyPrinter, localFormatSchema);
}
示例4: initStructure
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
@Nullable
private String initStructure(CanvasSessionData data, SelectionSession session, SingleSignonForm form)
{
final String courseId = data.getCourseId();
String structure = form.getStructure();
if( structure == null )
{
// if course ID is empty then there is nothing we can do...
if( Strings.isNullOrEmpty(courseId) )
{
throw new RuntimeException(LABEL_ERROR_NO_COURSE.getText());
}
structure = courseStructureCache.get(courseId).orNull();
}
// if no structure, get from Canvas
if( structure == null )
{
final ObjectNode root = objectMapper.createObjectNode();
root.put("id", courseId);
root.put("name", data.getContextTitle());
root.put("targetable", false);
final ArrayNode foldersNode = objectMapper.createArrayNode();
root.put("folders", foldersNode);
final Connector connector = findConnector(data);
final List<ConnectorFolder> folders = connectorRepoService.getFoldersForCourse(connector,
CurrentUser.getUsername(), courseId, false);
boolean first = true;
for( ConnectorFolder folder : folders )
{
final ObjectNode folderNode = objectMapper.createObjectNode();
folderNode.put("id", folder.getId());
folderNode.put("name", folder.getName());
folderNode.put("targetable", true);
folderNode.put("defaultFolder", first);
foldersNode.add(folderNode);
first = false;
}
final PrettyPrinter pp = new MinimalPrettyPrinter();
try
{
structure = objectMapper.writer().with(pp).writeValueAsString(root);
}
catch( JsonProcessingException e )
{
throw Throwables.propagate(e);
}
}
if( structure != null )
{
courseStructureCache.put(courseId, structure);
}
return structure;
}
示例5: getStructure
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
private String getStructure(String courseId, String connectorUuid, String selected)
{
try
{
final boolean isDefaultApplicable = !Strings.isNullOrEmpty(selected);
final String cacheKey = connectorUuid + ":" + courseId + (!isDefaultApplicable ? "" : ":" + selected);
String structure = courseStructureCache.get(cacheKey).orNull();
// if no structure, get from Brightspace
if( structure == null )
{
final Connector connector = connectorService.getByUuid(connectorUuid);
if( connector == null )
{
throw new RuntimeException("No connector with UUID = " + connectorUuid);
}
final ConnectorCourse course = brightspaceService.getCourse(connector, courseId);
final ObjectNode root = objectMapper.createObjectNode();
root.put("id", courseId);
root.put("name", course.getName());
root.put("targetable", false);
final ArrayNode foldersNode = objectMapper.createArrayNode();
root.put("folders", foldersNode);
final List<ConnectorFolder> folders = brightspaceService.getFoldersForCourse(connector, null, courseId,
false);
boolean first = true;
for( ConnectorFolder folder : folders )
{
final ObjectNode folderNode = objectMapper.createObjectNode();
folderNode.put("id", folder.getId());
folderNode.put("name", folder.getName());
folderNode.put("targetable", true);
folderNode.put("selected",
(!isDefaultApplicable && first) || (isDefaultApplicable && selected.equals(folder.getId())));
foldersNode.add(folderNode);
first = false;
recurseFolder(connector, courseId, folder, folderNode, selected);
}
final PrettyPrinter pp = new MinimalPrettyPrinter();
try
{
structure = objectMapper.writer().with(pp).writeValueAsString(root);
}
catch( JsonProcessingException e )
{
throw Throwables.propagate(e);
}
if( structure == null )
{
// Can't happen
throw new RuntimeException("Could not create structure");
}
courseStructureCache.put(cacheKey, structure);
}
return structure;
}
catch( LmsUserNotFoundException lms )
{
throw Throwables.propagate(lms);
}
}
示例6: MessageMarshaller
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
private MessageMarshaller(@Nullable PrettyPrinter prettyPrinter, MarshallerRegistry registry) {
this.prettyPrinter = prettyPrinter;
this.registry = registry;
}
示例7: setPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public void setPrettyPrinter(PrettyPrinter prettyPrinter) {
this.prettyPrinter = prettyPrinter;
}
示例8: getPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public PrettyPrinter getPrettyPrinter()
{
return this.delegate.getPrettyPrinter();
}
示例9: setPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public JsonGenerator setPrettyPrinter(PrettyPrinter paramPrettyPrinter)
{
this.delegate.setPrettyPrinter(paramPrettyPrinter);
return this;
}
示例10: getPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public static PrettyPrinter getPrettyPrinter() {
CustomPrettyPrinter prettyPrinter = new CustomPrettyPrinter();
prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
return prettyPrinter;
}
示例11: getPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public PrettyPrinter getPrettyPrinter()
{
return _prettyPrinter;
}
示例12: setPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public void setPrettyPrinter(PrettyPrinter prettyPrinter)
{
_prettyPrinter = prettyPrinter;
}
示例13: newCompactPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
@Override
protected PrettyPrinter newCompactPrinter() {
return new MinimalPrettyPrinter();
}
示例14: newPrettyPrinter
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
@Override
protected PrettyPrinter newPrettyPrinter() {
return new DefaultPrettyPrinter();
}
示例15: AbstractJacksonBackedJsonSerializer
import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
/**
* Instantiates a new Registered service json serializer.
*
* @param prettyPrinter the pretty printer
*/
public AbstractJacksonBackedJsonSerializer(final PrettyPrinter prettyPrinter) {
this.objectMapper = initializeObjectMapper();
this.prettyPrinter = prettyPrinter;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:AbstractJacksonBackedJsonSerializer.java