Java 类com.fasterxml.jackson.core.PrettyPrinter 实例源码

项目:GitHub    文件:TestJDKSerializability.java   
public void testPrettyPrinter() throws Exception
{
    PrettyPrinter p = new DefaultPrettyPrinter();
    byte[] stuff = jdkSerialize(p);
    PrettyPrinter back = jdkDeserialize(stuff);
    // what should we test?
    assertNotNull(back);
}
项目:QuizUpWinner    文件:ObjectWriter.java   
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);
}
项目:QuizUpWinner    文件:ObjectWriter.java   
protected ObjectWriter(ObjectWriter paramObjectWriter, SerializationConfig paramSerializationConfig, JavaType paramJavaType, JsonSerializer<Object> paramJsonSerializer, PrettyPrinter paramPrettyPrinter, FormatSchema paramFormatSchema)
{
  this._config = paramSerializationConfig;
  this._serializerProvider = paramObjectWriter._serializerProvider;
  this._serializerFactory = paramObjectWriter._serializerFactory;
  this._jsonFactory = paramObjectWriter._jsonFactory;
  this._rootType = paramJavaType;
  this._rootSerializer = paramJsonSerializer;
  this._prettyPrinter = paramPrettyPrinter;
  this._schema = paramFormatSchema;
}
项目:QuizUpWinner    文件:ObjectWriter.java   
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);
}
项目:Equella    文件:CanvasIntegration.java   
@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;
}
项目:Equella    文件:BrightspaceStructureInitServlet.java   
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);
    }
}
项目:curiostack    文件:MessageMarshaller.java   
private MessageMarshaller(@Nullable PrettyPrinter prettyPrinter, MarshallerRegistry registry) {
  this.prettyPrinter = prettyPrinter;
  this.registry = registry;
}
项目:ml-app-deployer    文件:ScaffoldGenerator.java   
public void setPrettyPrinter(PrettyPrinter prettyPrinter) {
    this.prettyPrinter = prettyPrinter;
}
项目:QuizUpWinner    文件:JsonGeneratorDelegate.java   
public PrettyPrinter getPrettyPrinter()
{
  return this.delegate.getPrettyPrinter();
}
项目:QuizUpWinner    文件:JsonGeneratorDelegate.java   
public JsonGenerator setPrettyPrinter(PrettyPrinter paramPrettyPrinter)
{
  this.delegate.setPrettyPrinter(paramPrettyPrinter);
  return this;
}
项目:glowroot    文件:ObjectMappers.java   
public static PrettyPrinter getPrettyPrinter() {
    CustomPrettyPrinter prettyPrinter = new CustomPrettyPrinter();
    prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
    return prettyPrinter;
}
项目:rest4j    文件:JacksonDataCodec.java   
public PrettyPrinter getPrettyPrinter()
{
  return _prettyPrinter;
}
项目:rest4j    文件:JacksonDataCodec.java   
public void setPrettyPrinter(PrettyPrinter prettyPrinter)
{
  _prettyPrinter = prettyPrinter;
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newCompactPrinter() {
    return new MinimalPrettyPrinter();
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newPrettyPrinter() {
    return new DefaultPrettyPrinter();
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newCompactPrinter() {
    // Yes, null is the proper answer.
    return null;
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newPrettyPrinter() {
    return new Log4jXmlPrettyPrinter(DEFAULT_INDENT);
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newCompactPrinter() {
    return new MinimalPrettyPrinter();
}
项目:logging-log4j2    文件:JacksonFactory.java   
@Override
protected PrettyPrinter newPrettyPrinter() {
    return new DefaultPrettyPrinter();
}
项目:springboot-shiro-cas-mybatis    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final PrettyPrinter prettyPrinter) {
    this.objectMapper = initializeObjectMapper();
    this.prettyPrinter = prettyPrinter;
}
项目:springboot-shiro-cas-mybatis    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param objectMapper  the object mapper
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final ObjectMapper objectMapper, final PrettyPrinter prettyPrinter) {
    this.objectMapper = objectMapper;
    this.prettyPrinter = prettyPrinter;
}
项目:springboot-shiro-cas-mybatis    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final PrettyPrinter prettyPrinter) {
    this.objectMapper = initializeObjectMapper();
    this.prettyPrinter = prettyPrinter;
}
项目:springboot-shiro-cas-mybatis    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param objectMapper  the object mapper
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final ObjectMapper objectMapper, final PrettyPrinter prettyPrinter) {
    this.objectMapper = objectMapper;
    this.prettyPrinter = prettyPrinter;
}
项目:cas-5.1.0    文件:AbstractJacksonBackedStringSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedStringSerializer(final PrettyPrinter prettyPrinter) {
    this.objectMapper = initializeObjectMapper();
    this.prettyPrinter = prettyPrinter;
}
项目:cas-5.1.0    文件:AbstractJacksonBackedStringSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param objectMapper  the object mapper
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedStringSerializer(final ObjectMapper objectMapper, final PrettyPrinter prettyPrinter) {
    this.objectMapper = objectMapper;
    this.prettyPrinter = prettyPrinter;
}
项目:cas-server-4.2.1    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final PrettyPrinter prettyPrinter) {
    this.objectMapper = initializeObjectMapper();
    this.prettyPrinter = prettyPrinter;
}
项目:cas-server-4.2.1    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param objectMapper  the object mapper
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final ObjectMapper objectMapper, final PrettyPrinter prettyPrinter) {
    this.objectMapper = objectMapper;
    this.prettyPrinter = prettyPrinter;
}
项目:cas4.1.9    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final PrettyPrinter prettyPrinter) {
    this.objectMapper = initializeObjectMapper();
    this.prettyPrinter = prettyPrinter;
}
项目:cas4.1.9    文件:AbstractJacksonBackedJsonSerializer.java   
/**
 * Instantiates a new Registered service json serializer.
 *
 * @param objectMapper  the object mapper
 * @param prettyPrinter the pretty printer
 */
public AbstractJacksonBackedJsonSerializer(final ObjectMapper objectMapper, final PrettyPrinter prettyPrinter) {
    this.objectMapper = objectMapper;
    this.prettyPrinter = prettyPrinter;
}
项目:biweekly    文件:JCalRawWriter.java   
/**
 * Sets the pretty printer to pretty-print the JSON with. Note that this
 * method implicitly enables indenting, so {@code setPrettyPrint(true)} does
 * not also need to be called.
 * @param prettyPrinter the custom pretty printer (defaults to an instance
 * of {@link JCalPrettyPrinter}, if {@code setPrettyPrint(true)} has been
 * called)
 */
public void setPrettyPrinter(PrettyPrinter prettyPrinter) {
    prettyPrint = true;
    this.prettyPrinter = prettyPrinter;
}
项目:java-smart-objects    文件:SmartObjectMapper.java   
/**
 * This method behaves similarly to the <code>writeValueAsString(Object value)</code> method
 * except that it includes an indentation prefix that will be prepended to each line of the
 * resulting string (except the first line).
 *
 * @param value The smart object to be written out as a string.
 * @param indentation The indentation string to be prepended to each line.
 * @return The formatted string.
 * @throws JsonProcessingException The JSON object mapper was not able to serialize the object.
 */
String writeValueAsString(Object value, String indentation) throws JsonProcessingException {
    PrettyPrinter printer = new BetterPrettyPrinter(indentation).withArrayIndenter(new DefaultIndenter());
    return writer(printer).writeValueAsString(value);
}
项目:logging-log4j2    文件:JacksonFactory.java   
abstract protected PrettyPrinter newCompactPrinter();
项目:logging-log4j2    文件:JacksonFactory.java   
abstract protected PrettyPrinter newPrettyPrinter();