Top Description Inners Fields Constructors Methods
org.hibernate.dialect

public Class XmlHelper

extends Object
Class Inheritance
Annotations
@Internal
Imports
java.io.IOException, .OutputStream, java.sql.SQLException, java.time.OffsetDateTime, java.time.format.DateTimeFormatter, java.util.ArrayList, .Base64, .List, org.hibernate.Internal, org.hibernate.internal.util.CharSequenceHelper, org.hibernate.metamodel.mapping.AttributeMapping, .EmbeddableMappingType, .JdbcMapping, .SelectableMapping, org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping, org.hibernate.sql.ast.spi.SqlAppender, org.hibernate.type.SqlTypes, org.hibernate.type.descriptor.WrapperOptions, org.hibernate.type.descriptor.java.IntegerJavaType, .JavaType, .JdbcDateJavaType, .JdbcTimeJavaType, .JdbcTimestampJavaType, .OffsetDateTimeJavaType, org.hibernate.type.descriptor.jdbc.AggregateJdbcType

A Helper for serializing and deserializing XML, based on an EmbeddableMappingType.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final String
public static final String
ROOT_TAG

The root tag under which values are placed as XML elements.

private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Object
fromEscapedString(JdbcMapping jdbcMapping, String string, int start, int end)

private static Object
fromRawObject(JdbcMapping jdbcMapping, Object raw, WrapperOptions options)

private static Object
fromString(JdbcMapping jdbcMapping, String string, int start, int end)

private static Object
fromString(EmbeddableMappingType embeddableMappingType, String string, WrapperOptions options, int selectableIndex, int start, int end)

public static <X> X
fromString(EmbeddableMappingType embeddableMappingType, String string, boolean returnEmbeddable, WrapperOptions options)

private static int
fromString(String string, List<Object> values, int start)

private static int
fromString(EmbeddableMappingType embeddableMappingType, String string, boolean returnEmbeddable, WrapperOptions options, Object[] values, int start)

private static int
getSelectableMapping(EmbeddableMappingType embeddableMappingType, String name)

private static void
public static String
toString(EmbeddableMappingType embeddableMappingType, Object value, WrapperOptions options)

private static void
toString(EmbeddableMappingType embeddableMappingType, Object value, WrapperOptions options, XmlHelper.XMLAppender sb)

private static String
unescape(String string, int start, int end)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

END_TAGback to summary
private static final String END_TAG
ROOT_TAGback to summary
public static final String ROOT_TAG

The root tag under which values are placed as XML elements.

START_TAGback to summary
private static final String START_TAG

Constructor Detail

XmlHelperback to summary
public XmlHelper()

Method Detail

fromEscapedStringback to summary
private static Object fromEscapedString(JdbcMapping jdbcMapping, String string, int start, int end)
fromRawObjectback to summary
private static Object fromRawObject(JdbcMapping jdbcMapping, Object raw, WrapperOptions options)
fromStringback to summary
private static Object fromString(JdbcMapping jdbcMapping, String string, int start, int end)
fromStringback to summary
private static Object fromString(EmbeddableMappingType embeddableMappingType, String string, WrapperOptions options, int selectableIndex, int start, int end)
fromStringback to summary
public static <X> X fromString(EmbeddableMappingType embeddableMappingType, String string, boolean returnEmbeddable, WrapperOptions options) throws SQLException
fromStringback to summary
private static int fromString(String string, List<Object> values, int start)
fromStringback to summary
private static int fromString(EmbeddableMappingType embeddableMappingType, String string, boolean returnEmbeddable, WrapperOptions options, Object[] values, int start) throws SQLException
getSelectableMappingback to summary
private static int getSelectableMapping(EmbeddableMappingType embeddableMappingType, String name)
serializeValueToback to summary
private static void serializeValueTo(XmlHelper.XMLAppender appender, SelectableMapping selectable, Object value, WrapperOptions options)
toStringback to summary
public static String toString(EmbeddableMappingType embeddableMappingType, Object value, WrapperOptions options)
toStringback to summary
private static void toString(EmbeddableMappingType embeddableMappingType, Object value, WrapperOptions options, XmlHelper.XMLAppender sb)
unescapeback to summary
private static String unescape(String string, int start, int end)
org.hibernate.dialect back to summary

private Class XmlHelper.XMLAppender

extends OutputStream
implements SqlAppender
Class Inheritance
All Implemented Interfaces
org.hibernate.sql.ast.spi.SqlAppender, java.lang.Appendable

Field Summary

Modifier and TypeField and Description
private OutputStream
private boolean
private static final char[]
private final StringBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public XmlHelper.XMLAppender
append(char
The character to append
fragment
)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Appends the specified character to this Appendable.
public XmlHelper.XMLAppender
append(CharSequence
The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.
csq
)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Appends the specified character sequence to this Appendable.
public XmlHelper.XMLAppender
append(CharSequence
The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".
csq
,
int
The index of the first character in the subsequence
start
,
int
The index of the character following the last character in the subsequence
end
)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Appends a subsequence of the specified character sequence to this Appendable.
private void
appendEscaped(char fragment)

public void
appendSql(String fragment)

Implements org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Add the passed fragment into the in-flight buffer
public void
public void
public void
public void
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
write(int
the byte.
v
)

Implements abstract java.io.OutputStream.write.

Writes the specified byte to this output stream.
public void
write(byte[]
the data.
bytes
)

Overrides java.io.OutputStream.write.

Writes b.length bytes from the specified byte array to this output stream.
public void
write(byte[]
the data.
bytes
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public void
writeBase64(byte[] bytes)

Inherited from java.io.OutputStream:
closeflushnullOutputStream

Field Detail

base64OutputStreamback to summary
private OutputStream base64OutputStream
escapeback to summary
private boolean escape
HEX_ARRAYback to summary
private static final char[] HEX_ARRAY
sbback to summary
private final StringBuilder sb

Constructor Detail

XMLAppenderback to summary
public XMLAppender(StringBuilder sb)

Method Detail

appendback to summary
public XmlHelper.XMLAppender append(char fragment)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Doc from java.lang.Appendable.append.

Appends the specified character to this Appendable.

Parameters
fragment:char

The character to append

Returns:XmlHelper.XMLAppender

A reference to this Appendable

Annotations
@Override
appendback to summary
public XmlHelper.XMLAppender append(CharSequence csq)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Doc from java.lang.Appendable.append.

Appends the specified character sequence to this Appendable.

Depending on which class implements the character sequence csq, the entire sequence may not be appended. For instance, if csq is a java.nio.CharBuffer then the subsequence to append is defined by the buffer's position and limit.

Parameters
csq:CharSequence

The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.

Returns:XmlHelper.XMLAppender

A reference to this Appendable

Annotations
@Override
appendback to summary
public XmlHelper.XMLAppender append(CharSequence csq, int start, int end)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.append.

Doc from java.lang.Appendable.append.

Appends a subsequence of the specified character sequence to this Appendable.

An invocation of this method of the form out.append(csq, start, end) when csq is not null, behaves in exactly the same way as the invocation

    out.append(csq.subSequence(start, end)) 
Parameters
csq:CharSequence

The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".

start:int

The index of the first character in the subsequence

end:int

The index of the character following the last character in the subsequence

Returns:XmlHelper.XMLAppender

A reference to this Appendable

Annotations
@Override
appendEscapedback to summary
private void appendEscaped(char fragment)
appendSqlback to summary
public void appendSql(String fragment)

Implements org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Doc from org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Add the passed fragment into the in-flight buffer

Annotations
@Override
appendSqlback to summary
public void appendSql(char fragment)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Annotations
@Override
appendSqlback to summary
public void appendSql(int value)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Annotations
@Override
appendSqlback to summary
public void appendSql(long value)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Annotations
@Override
appendSqlback to summary
public void appendSql(boolean value)

Overrides default org.hibernate.sql.ast.spi.SqlAppender.appendSql.

Annotations
@Override
endEscapingback to summary
public void endEscaping()
startEscapingback to summary
public void startEscaping()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeback to summary
public void write(int v)

Implements abstract java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Parameters
v:int

the byte.

Annotations
@Override
writeback to summary
public void write(byte[] bytes)

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).

Parameters
bytes:byte[]

the data.

Annotations
@Override
writeback to summary
public void write(byte[] bytes, int off, int len)

Overrides java.io.OutputStream.write.

Doc from java.io.OutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Parameters
bytes:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Annotations
@Override
writeBase64back to summary
public void writeBase64(byte[] bytes)