当前位置: 首页>>代码示例>>Java>>正文


Java PrettyPrinter类代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:TestJDKSerializability.java

示例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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:14,代码来源:ObjectWriter.java

示例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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:13,代码来源:ObjectWriter.java

示例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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:56,代码来源:CanvasIntegration.java

示例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);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:69,代码来源:BrightspaceStructureInitServlet.java

示例6: MessageMarshaller

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
private MessageMarshaller(@Nullable PrettyPrinter prettyPrinter, MarshallerRegistry registry) {
  this.prettyPrinter = prettyPrinter;
  this.registry = registry;
}
 
开发者ID:curioswitch,项目名称:curiostack,代码行数:5,代码来源:MessageMarshaller.java

示例7: setPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public void setPrettyPrinter(PrettyPrinter prettyPrinter) {
	this.prettyPrinter = prettyPrinter;
}
 
开发者ID:marklogic-community,项目名称:ml-app-deployer,代码行数:4,代码来源:ScaffoldGenerator.java

示例8: getPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public PrettyPrinter getPrettyPrinter()
{
  return this.delegate.getPrettyPrinter();
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:JsonGeneratorDelegate.java

示例9: setPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public JsonGenerator setPrettyPrinter(PrettyPrinter paramPrettyPrinter)
{
  this.delegate.setPrettyPrinter(paramPrettyPrinter);
  return this;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:6,代码来源:JsonGeneratorDelegate.java

示例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;
}
 
开发者ID:glowroot,项目名称:glowroot,代码行数:6,代码来源:ObjectMappers.java

示例11: getPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public PrettyPrinter getPrettyPrinter()
{
  return _prettyPrinter;
}
 
开发者ID:ppdai,项目名称:rest4j,代码行数:5,代码来源:JacksonDataCodec.java

示例12: setPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
public void setPrettyPrinter(PrettyPrinter prettyPrinter)
{
  _prettyPrinter = prettyPrinter;
}
 
开发者ID:ppdai,项目名称:rest4j,代码行数:5,代码来源:JacksonDataCodec.java

示例13: newCompactPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
@Override
protected PrettyPrinter newCompactPrinter() {
    return new MinimalPrettyPrinter();
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:5,代码来源:JacksonFactory.java

示例14: newPrettyPrinter

import com.fasterxml.jackson.core.PrettyPrinter; //导入依赖的package包/类
@Override
protected PrettyPrinter newPrettyPrinter() {
    return new DefaultPrettyPrinter();
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:5,代码来源:JacksonFactory.java

示例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


注:本文中的com.fasterxml.jackson.core.PrettyPrinter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。