repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readLongArray | public long[] readLongArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
long[] buffer = new long[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final long next = readLong(byteOrder);
if (buffer.length ... | java | public long[] readLongArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
long[] buffer = new long[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final long next = readLong(byteOrder);
if (buffer.length ... | [
"public",
"long",
"[",
"]",
"readLongArray",
"(",
"final",
"int",
"items",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"int",
"pos",
"=",
"0",
";",
"if",
"(",
"items",
"<",
"0",
")",
"{",
"long",
"[",
"]",
"buffer",
... | Read number of long items from the input stream.
@param items number of items to be read from the input stream, if less than
zero then all stream till the end will be read
@param byteOrder the order of bytes to be used to decode values
@return read items as a long array
@throws IOException it will be thrown for an... | [
"Read",
"number",
"of",
"long",
"items",
"from",
"the",
"input",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L416-L444 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readDoubleArray | public double[] readDoubleArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
double[] buffer = new double[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final long next = readLong(byteOrder);
if (buffer... | java | public double[] readDoubleArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
double[] buffer = new double[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final long next = readLong(byteOrder);
if (buffer... | [
"public",
"double",
"[",
"]",
"readDoubleArray",
"(",
"final",
"int",
"items",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"int",
"pos",
"=",
"0",
";",
"if",
"(",
"items",
"<",
"0",
")",
"{",
"double",
"[",
"]",
"buff... | Read number of double items from the input stream.
@param items number of items to be read from the input stream, if less than
zero then all stream till the end will be read
@param byteOrder the order of bytes to be used to decode values
@return read items as a double array
@throws IOException it will be thrown fo... | [
"Read",
"number",
"of",
"double",
"items",
"from",
"the",
"input",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L459-L487 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readUnsignedShort | public int readUnsignedShort(final JBBPByteOrder byteOrder) throws IOException {
final int b0 = this.read();
if (b0 < 0) {
throw new EOFException();
}
final int b1 = this.read();
if (b1 < 0) {
throw new EOFException();
}
return byteOrder == JBBPByteOrder.BIG_ENDIAN ? (b0 << 8) | ... | java | public int readUnsignedShort(final JBBPByteOrder byteOrder) throws IOException {
final int b0 = this.read();
if (b0 < 0) {
throw new EOFException();
}
final int b1 = this.read();
if (b1 < 0) {
throw new EOFException();
}
return byteOrder == JBBPByteOrder.BIG_ENDIAN ? (b0 << 8) | ... | [
"public",
"int",
"readUnsignedShort",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"int",
"b0",
"=",
"this",
".",
"read",
"(",
")",
";",
"if",
"(",
"b0",
"<",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
... | Read a unsigned short value from the stream.
@param byteOrder he order of bytes to be used to decode the read value
@return the unsigned short value read from stream
@throws IOException it will be thrown for any transport problem during the
operation
@throws EOFException if the end of the stream has been reached
@see... | [
"Read",
"a",
"unsigned",
"short",
"value",
"from",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L500-L510 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readInt | public int readInt(final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
return (readUnsignedShort(byteOrder) << 16) | readUnsignedShort(byteOrder);
} else {
return readUnsignedShort(byteOrder) | (readUnsignedShort(byteOrder) << 16);
}
} | java | public int readInt(final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
return (readUnsignedShort(byteOrder) << 16) | readUnsignedShort(byteOrder);
} else {
return readUnsignedShort(byteOrder) | (readUnsignedShort(byteOrder) << 16);
}
} | [
"public",
"int",
"readInt",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"return",
"(",
"readUnsignedShort",
"(",
"byteOrder",
")",
"<<",
"16",
")",
... | Read an integer value from the stream.
@param byteOrder the order of bytes to be used to decode the read value
@return the integer value from the stream
@throws IOException it will be thrown for any transport problem during the
operation
@throws EOFException if the end of the stream has been reached
@see JBBPByteOrde... | [
"Read",
"an",
"integer",
"value",
"from",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L523-L529 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readFloat | public float readFloat(final JBBPByteOrder byteOrder) throws IOException {
final int value;
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
value = (readUnsignedShort(byteOrder) << 16) | readUnsignedShort(byteOrder);
} else {
value = readUnsignedShort(byteOrder) | (readUnsignedShort(byteOrder) << 1... | java | public float readFloat(final JBBPByteOrder byteOrder) throws IOException {
final int value;
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
value = (readUnsignedShort(byteOrder) << 16) | readUnsignedShort(byteOrder);
} else {
value = readUnsignedShort(byteOrder) | (readUnsignedShort(byteOrder) << 1... | [
"public",
"float",
"readFloat",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"int",
"value",
";",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"value",
"=",
"(",
"readUnsignedShort",
"("... | Read a float value from the stream.
@param byteOrder the order of bytes to be used to decode the read value
@return the float value from the stream
@throws IOException it will be thrown for any transport problem during the
operation
@throws EOFException if the end of the stream has been reached
@see JBBPByteOrder#BIG... | [
"Read",
"a",
"float",
"value",
"from",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L543-L551 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readLong | public long readLong(final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
return (((long) readInt(byteOrder) & 0xFFFFFFFFL) << 32) | ((long) readInt(byteOrder) & 0xFFFFFFFFL);
} else {
return ((long) readInt(byteOrder) & 0xFFFFFFFFL) | (((long) readInt(byt... | java | public long readLong(final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
return (((long) readInt(byteOrder) & 0xFFFFFFFFL) << 32) | ((long) readInt(byteOrder) & 0xFFFFFFFFL);
} else {
return ((long) readInt(byteOrder) & 0xFFFFFFFFL) | (((long) readInt(byt... | [
"public",
"long",
"readLong",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"readInt",
"(",
"byteOrder",
")",
... | Read a long value from the stream.
@param byteOrder the order of bytes to be used to decode the read value
@return the long value from stream
@throws IOException it will be thrown for any transport problem during the
operation
@throws EOFException if the end of the stream has been reached
@see JBBPByteOrder#BIG_ENDIA... | [
"Read",
"a",
"long",
"value",
"from",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L564-L570 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readDouble | public double readDouble(final JBBPByteOrder byteOrder) throws IOException {
final long value;
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
value = (((long) readInt(byteOrder) & 0xFFFFFFFFL) << 32) | ((long) readInt(byteOrder) & 0xFFFFFFFFL);
} else {
value = ((long) readInt(byteOrder) & 0xFFFFF... | java | public double readDouble(final JBBPByteOrder byteOrder) throws IOException {
final long value;
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
value = (((long) readInt(byteOrder) & 0xFFFFFFFFL) << 32) | ((long) readInt(byteOrder) & 0xFFFFFFFFL);
} else {
value = ((long) readInt(byteOrder) & 0xFFFFF... | [
"public",
"double",
"readDouble",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"long",
"value",
";",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"value",
"=",
"(",
"(",
"(",
"long",
... | Read a double value from the stream.
@param byteOrder the order of bytes to be used to decode the read value
@return the double value from stream
@throws IOException it will be thrown for any transport problem during the
operation
@throws EOFException if the end of the stream has been reached
@see JBBPByteOrder#BIG_E... | [
"Read",
"a",
"double",
"value",
"from",
"the",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L584-L592 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readBitField | public byte readBitField(final JBBPBitNumber numOfBitsToRead) throws IOException {
final int value = this.readBits(numOfBitsToRead);
if (value < 0) {
throw new EOFException("Can't read bits from stream [" + numOfBitsToRead + ']');
}
return (byte) value;
} | java | public byte readBitField(final JBBPBitNumber numOfBitsToRead) throws IOException {
final int value = this.readBits(numOfBitsToRead);
if (value < 0) {
throw new EOFException("Can't read bits from stream [" + numOfBitsToRead + ']');
}
return (byte) value;
} | [
"public",
"byte",
"readBitField",
"(",
"final",
"JBBPBitNumber",
"numOfBitsToRead",
")",
"throws",
"IOException",
"{",
"final",
"int",
"value",
"=",
"this",
".",
"readBits",
"(",
"numOfBitsToRead",
")",
";",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
... | Read bit field from the stream, if it is impossible then IOException will be thrown.
@param numOfBitsToRead field width, must not be null
@return read value from the stream
@throws IOException it will be thrown if EOF or troubles to read the stream
@since 1.3.0 | [
"Read",
"bit",
"field",
"from",
"the",
"stream",
"if",
"it",
"is",
"impossible",
"then",
"IOException",
"will",
"be",
"thrown",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L644-L650 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readBits | public int readBits(final JBBPBitNumber numOfBitsToRead) throws IOException {
int result;
final int numOfBitsAsNumber = numOfBitsToRead.getBitNumber();
if (this.bitsInBuffer == 0 && numOfBitsAsNumber == 8) {
result = this.readByteFromStream();
if (result >= 0) {
this.byteCounter++;
... | java | public int readBits(final JBBPBitNumber numOfBitsToRead) throws IOException {
int result;
final int numOfBitsAsNumber = numOfBitsToRead.getBitNumber();
if (this.bitsInBuffer == 0 && numOfBitsAsNumber == 8) {
result = this.readByteFromStream();
if (result >= 0) {
this.byteCounter++;
... | [
"public",
"int",
"readBits",
"(",
"final",
"JBBPBitNumber",
"numOfBitsToRead",
")",
"throws",
"IOException",
"{",
"int",
"result",
";",
"final",
"int",
"numOfBitsAsNumber",
"=",
"numOfBitsToRead",
".",
"getBitNumber",
"(",
")",
";",
"if",
"(",
"this",
".",
"bi... | Read number of bits from the input stream. It reads bits from input stream
since 0 bit and make reversion to return bits in the right order when 0 bit
is 0 bit. if the stream is completed early than the data read then reading
is just stopped and read value returned. The First read bit is placed as
0th bit.
@param numO... | [
"Read",
"number",
"of",
"bits",
"from",
"the",
"input",
"stream",
".",
"It",
"reads",
"bits",
"from",
"input",
"stream",
"since",
"0",
"bit",
"and",
"make",
"reversion",
"to",
"return",
"bits",
"in",
"the",
"right",
"order",
"when",
"0",
"bit",
"is",
"... | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L664-L721 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.align | public void align(final long alignByteNumber) throws IOException {
this.alignByte();
if (alignByteNumber > 0) {
long padding = (alignByteNumber - (this.byteCounter % alignByteNumber)) % alignByteNumber;
while (padding > 0) {
final int skippedByte = this.read();
if (skippedByte < 0)... | java | public void align(final long alignByteNumber) throws IOException {
this.alignByte();
if (alignByteNumber > 0) {
long padding = (alignByteNumber - (this.byteCounter % alignByteNumber)) % alignByteNumber;
while (padding > 0) {
final int skippedByte = this.read();
if (skippedByte < 0)... | [
"public",
"void",
"align",
"(",
"final",
"long",
"alignByteNumber",
")",
"throws",
"IOException",
"{",
"this",
".",
"alignByte",
"(",
")",
";",
"if",
"(",
"alignByteNumber",
">",
"0",
")",
"{",
"long",
"padding",
"=",
"(",
"alignByteNumber",
"-",
"(",
"t... | Read padding bytes from the stream and ignore them to align the stream
counter.
@param alignByteNumber the byte number to align the stream
@throws IOException it will be thrown for transport errors
@throws EOFException it will be thrown if the stream end has been reached
the before align border. | [
"Read",
"padding",
"bytes",
"from",
"the",
"stream",
"and",
"ignore",
"them",
"to",
"align",
"the",
"stream",
"counter",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L776-L791 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readByteFromStream | private int readByteFromStream() throws IOException {
int result = this.in.read();
if (result >= 0 && this.msb0) {
result = JBBPUtils.reverseBitsInByte((byte) result) & 0xFF;
}
return result;
} | java | private int readByteFromStream() throws IOException {
int result = this.in.read();
if (result >= 0 && this.msb0) {
result = JBBPUtils.reverseBitsInByte((byte) result) & 0xFF;
}
return result;
} | [
"private",
"int",
"readByteFromStream",
"(",
")",
"throws",
"IOException",
"{",
"int",
"result",
"=",
"this",
".",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"result",
">=",
"0",
"&&",
"this",
".",
"msb0",
")",
"{",
"result",
"=",
"JBBPUtils",
".",... | Inside method to read a byte from stream.
@return the read byte or -1 if the end of the stream has been reached
@throws IOException it will be thrown for transport errors | [
"Inside",
"method",
"to",
"read",
"a",
"byte",
"from",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L820-L826 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.loadNextByteInBuffer | private int loadNextByteInBuffer() throws IOException {
final int value = this.readByteFromStream();
if (value < 0) {
return value;
}
this.bitBuffer = value;
this.bitsInBuffer = 8;
return value;
} | java | private int loadNextByteInBuffer() throws IOException {
final int value = this.readByteFromStream();
if (value < 0) {
return value;
}
this.bitBuffer = value;
this.bitsInBuffer = 8;
return value;
} | [
"private",
"int",
"loadNextByteInBuffer",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"value",
"=",
"this",
".",
"readByteFromStream",
"(",
")",
";",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"return",
"value",
";",
"}",
"this",
".",
"bitBuffer... | Read the next stream byte into bit buffer.
@return the read byte or -1 if the endo of stream has been reached.
@throws IOException it will be thrown for transport errors | [
"Read",
"the",
"next",
"stream",
"byte",
"into",
"bit",
"buffer",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L834-L844 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readString | public String readString(final JBBPByteOrder byteOrder) throws IOException {
final int prefix = this.readByte();
final int len;
if (prefix == 0) {
len = 0;
} else if (prefix == 0xFF) {
len = -1;
} else if (prefix < 0x80) {
len = prefix;
} else if ((prefix & 0xF0) == 0x80) {
... | java | public String readString(final JBBPByteOrder byteOrder) throws IOException {
final int prefix = this.readByte();
final int len;
if (prefix == 0) {
len = 0;
} else if (prefix == 0xFF) {
len = -1;
} else if (prefix < 0x80) {
len = prefix;
} else if ((prefix & 0xF0) == 0x80) {
... | [
"public",
"String",
"readString",
"(",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"final",
"int",
"prefix",
"=",
"this",
".",
"readByte",
"(",
")",
";",
"final",
"int",
"len",
";",
"if",
"(",
"prefix",
"==",
"0",
")",
"{",
... | Read string in UTF8 format.
@param byteOrder byte order, must not be null
@return read string, can be null
@throws IOException it will be thrown for transport error or wrong format
@see JBBPBitOutputStream#writeString(String, JBBPByteOrder)
@since 1.4.0 | [
"Read",
"string",
"in",
"UTF8",
"format",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L966-L1017 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java | JBBPBitInputStream.readStringArray | public String[] readStringArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
String[] buffer = new String[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final String next = readString(byteOrder);
if (bu... | java | public String[] readStringArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
String[] buffer = new String[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final String next = readString(byteOrder);
if (bu... | [
"public",
"String",
"[",
"]",
"readStringArray",
"(",
"final",
"int",
"items",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"int",
"pos",
"=",
"0",
";",
"if",
"(",
"items",
"<",
"0",
")",
"{",
"String",
"[",
"]",
"buff... | Read array of srings from stream.
@param items number of items, or -1 if read whole stream
@param byteOrder order of bytes in structure, must not be null
@return array, it can contain null among values, must not be null
@throws IOException thrown for transport errors
@see JBBPBitOutputStream#writeStringArray(Strin... | [
"Read",
"array",
"of",
"srings",
"from",
"stream",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitInputStream.java#L1030-L1059 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiledBlock.java | JBBPCompiledBlock.findFieldForPath | public JBBPNamedFieldInfo findFieldForPath(final String fieldPath) {
JBBPNamedFieldInfo result = null;
for (final JBBPNamedFieldInfo f : this.namedFieldData) {
if (f.getFieldPath().equals(fieldPath)) {
result = f;
break;
}
}
return result;
} | java | public JBBPNamedFieldInfo findFieldForPath(final String fieldPath) {
JBBPNamedFieldInfo result = null;
for (final JBBPNamedFieldInfo f : this.namedFieldData) {
if (f.getFieldPath().equals(fieldPath)) {
result = f;
break;
}
}
return result;
} | [
"public",
"JBBPNamedFieldInfo",
"findFieldForPath",
"(",
"final",
"String",
"fieldPath",
")",
"{",
"JBBPNamedFieldInfo",
"result",
"=",
"null",
";",
"for",
"(",
"final",
"JBBPNamedFieldInfo",
"f",
":",
"this",
".",
"namedFieldData",
")",
"{",
"if",
"(",
"f",
"... | Find a field for its path.
@param fieldPath a field path
@return a field to be found for the path, null otherwise | [
"Find",
"a",
"field",
"for",
"its",
"path",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiledBlock.java#L166-L177 | train |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiledBlock.java | JBBPCompiledBlock.findFieldOffsetForPath | public int findFieldOffsetForPath(final String fieldPath) {
for (final JBBPNamedFieldInfo f : this.namedFieldData) {
if (f.getFieldPath().equals(fieldPath)) {
return f.getFieldOffsetInCompiledBlock();
}
}
throw new JBBPIllegalArgumentException("Unknown field path [" + fieldPath + ']');
... | java | public int findFieldOffsetForPath(final String fieldPath) {
for (final JBBPNamedFieldInfo f : this.namedFieldData) {
if (f.getFieldPath().equals(fieldPath)) {
return f.getFieldOffsetInCompiledBlock();
}
}
throw new JBBPIllegalArgumentException("Unknown field path [" + fieldPath + ']');
... | [
"public",
"int",
"findFieldOffsetForPath",
"(",
"final",
"String",
"fieldPath",
")",
"{",
"for",
"(",
"final",
"JBBPNamedFieldInfo",
"f",
":",
"this",
".",
"namedFieldData",
")",
"{",
"if",
"(",
"f",
".",
"getFieldPath",
"(",
")",
".",
"equals",
"(",
"fiel... | Find offset of a field in the compiled block for its field path.
@param fieldPath a field path, it must not be null
@return the offset as integer for the field path
@throws JBBPException if the field is not found | [
"Find",
"offset",
"of",
"a",
"field",
"in",
"the",
"compiled",
"block",
"for",
"its",
"field",
"path",
"."
] | 6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiledBlock.java#L186-L193 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java | PrivilegeEventProducer.sendEvent | @Deprecated
public void sendEvent(String eventId, String ymlPrivileges) {
SystemEvent event = buildSystemEvent(eventId, ymlPrivileges);
serializeEvent(event).ifPresent(this::send);
} | java | @Deprecated
public void sendEvent(String eventId, String ymlPrivileges) {
SystemEvent event = buildSystemEvent(eventId, ymlPrivileges);
serializeEvent(event).ifPresent(this::send);
} | [
"@",
"Deprecated",
"public",
"void",
"sendEvent",
"(",
"String",
"eventId",
",",
"String",
"ymlPrivileges",
")",
"{",
"SystemEvent",
"event",
"=",
"buildSystemEvent",
"(",
"eventId",
",",
"ymlPrivileges",
")",
";",
"serializeEvent",
"(",
"event",
")",
".",
"if... | Build message for kafka's event and send it.
@param eventId the event id
@param ymlPrivileges the content
@deprecated left only for backward compatibility, use {@link #sendEvent(String, Set)} | [
"Build",
"message",
"for",
"kafka",
"s",
"event",
"and",
"send",
"it",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java#L48-L52 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java | PrivilegeEventProducer.sendEvent | public void sendEvent(String eventId, Set<Privilege> privileges) {
// TODO do not use yml in json events...
String ymlPrivileges = PrivilegeMapper.privilegesToYml(privileges);
SystemEvent event = buildSystemEvent(eventId, ymlPrivileges);
serializeEvent(event).ifPresent(this::send);
... | java | public void sendEvent(String eventId, Set<Privilege> privileges) {
// TODO do not use yml in json events...
String ymlPrivileges = PrivilegeMapper.privilegesToYml(privileges);
SystemEvent event = buildSystemEvent(eventId, ymlPrivileges);
serializeEvent(event).ifPresent(this::send);
... | [
"public",
"void",
"sendEvent",
"(",
"String",
"eventId",
",",
"Set",
"<",
"Privilege",
">",
"privileges",
")",
"{",
"// TODO do not use yml in json events...",
"String",
"ymlPrivileges",
"=",
"PrivilegeMapper",
".",
"privilegesToYml",
"(",
"privileges",
")",
";",
"S... | Build MS_PRIVILEGES message for system queue event and send it.
@param eventId the event id
@param privileges the event data (privileges) | [
"Build",
"MS_PRIVILEGES",
"message",
"for",
"system",
"queue",
"event",
"and",
"send",
"it",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java#L60-L66 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java | PrivilegeEventProducer.send | private void send(String content) {
if (!StringUtils.isBlank(content)) {
log.info("Sending system queue event to kafka-topic = '{}', data = '{}'", topicName, content);
template.send(topicName, content);
}
} | java | private void send(String content) {
if (!StringUtils.isBlank(content)) {
log.info("Sending system queue event to kafka-topic = '{}', data = '{}'", topicName, content);
template.send(topicName, content);
}
} | [
"private",
"void",
"send",
"(",
"String",
"content",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"content",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Sending system queue event to kafka-topic = '{}', data = '{}'\"",
",",
"topicName",
",",
"con... | Send event to system queue.
@param content the event content | [
"Send",
"event",
"to",
"system",
"queue",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java#L93-L98 | train |
xm-online/xm-commons | xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java | DatabaseUtil.createSchema | public static void createSchema(DataSource dataSource, String name) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
} catch (SQLException e... | java | public static void createSchema(DataSource dataSource, String name) {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name));
} catch (SQLException e... | [
"public",
"static",
"void",
"createSchema",
"(",
"DataSource",
"dataSource",
",",
"String",
"name",
")",
"{",
"try",
"(",
"Connection",
"connection",
"=",
"dataSource",
".",
"getConnection",
"(",
")",
";",
"Statement",
"statement",
"=",
"connection",
".",
"cre... | Creates new database scheme.
@param dataSource the datasource
@param name schema name | [
"Creates",
"new",
"database",
"scheme",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java#L25-L32 | train |
xm-online/xm-commons | xm-commons-messaging/src/main/java/com/icthh/xm/commons/messaging/event/system/SystemEvent.java | SystemEvent.getDataMap | @JsonIgnore
@SuppressWarnings("unchecked")
public Map<String, Object> getDataMap() {
if (data instanceof Map) {
return (Map<String, Object>) data;
}
return Collections.emptyMap();
} | java | @JsonIgnore
@SuppressWarnings("unchecked")
public Map<String, Object> getDataMap() {
if (data instanceof Map) {
return (Map<String, Object>) data;
}
return Collections.emptyMap();
} | [
"@",
"JsonIgnore",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getDataMap",
"(",
")",
"{",
"if",
"(",
"data",
"instanceof",
"Map",
")",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"Object",
... | Get data as Map.
@return map with data | [
"Get",
"data",
"as",
"Map",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-messaging/src/main/java/com/icthh/xm/commons/messaging/event/system/SystemEvent.java#L45-L52 | train |
xm-online/xm-commons | xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java | LocalizationMessageService.getMessage | public String getMessage(String code,
Map<String, String> substitutes,
boolean firstFindInMessageBundle,
String defaultMessage) {
Locale locale = authContextHolder.getContext().getDetailsValue(LANGUAGE)
... | java | public String getMessage(String code,
Map<String, String> substitutes,
boolean firstFindInMessageBundle,
String defaultMessage) {
Locale locale = authContextHolder.getContext().getDetailsValue(LANGUAGE)
... | [
"public",
"String",
"getMessage",
"(",
"String",
"code",
",",
"Map",
"<",
"String",
",",
"String",
">",
"substitutes",
",",
"boolean",
"firstFindInMessageBundle",
",",
"String",
"defaultMessage",
")",
"{",
"Locale",
"locale",
"=",
"authContextHolder",
".",
"getC... | Finds localized message template by code and current locale from config. If not found it
takes message from message bundle or from default message first, depends on flag.
@param code the message code
@param firstFindInMessageBundle indicates where try to find message first when config has
returned NULL
@param defaultMe... | [
"Finds",
"localized",
"message",
"template",
"by",
"code",
"and",
"current",
"locale",
"from",
"config",
".",
"If",
"not",
"found",
"it",
"takes",
"message",
"from",
"message",
"bundle",
"or",
"from",
"default",
"message",
"first",
"depends",
"on",
"flag",
"... | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java#L64-L84 | train |
xm-online/xm-commons | xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java | LocalizationMessageService.getMessage | public String getMessage(String code, Map<String, String> substitutes) {
return getMessage(code, substitutes, true, null);
} | java | public String getMessage(String code, Map<String, String> substitutes) {
return getMessage(code, substitutes, true, null);
} | [
"public",
"String",
"getMessage",
"(",
"String",
"code",
",",
"Map",
"<",
"String",
",",
"String",
">",
"substitutes",
")",
"{",
"return",
"getMessage",
"(",
"code",
",",
"substitutes",
",",
"true",
",",
"null",
")",
";",
"}"
] | Finds localized message template by code and current locale from config. If not found it
takes message from message bundle and replaces all the occurrences of variables with their
matching values from the substitute map.
@param code the message code
@param substitutes the substitute map for message template
@return loc... | [
"Finds",
"localized",
"message",
"template",
"by",
"code",
"and",
"current",
"locale",
"from",
"config",
".",
"If",
"not",
"found",
"it",
"takes",
"message",
"from",
"message",
"bundle",
"and",
"replaces",
"all",
"the",
"occurrences",
"of",
"variables",
"with"... | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java#L104-L106 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/RoleService.java | RoleService.getRoles | public Map<String, Role> getRoles(String tenant) {
if (!roles.containsKey(tenant)) {
return new HashMap<>();
}
return roles.get(tenant);
} | java | public Map<String, Role> getRoles(String tenant) {
if (!roles.containsKey(tenant)) {
return new HashMap<>();
}
return roles.get(tenant);
} | [
"public",
"Map",
"<",
"String",
",",
"Role",
">",
"getRoles",
"(",
"String",
"tenant",
")",
"{",
"if",
"(",
"!",
"roles",
".",
"containsKey",
"(",
"tenant",
")",
")",
"{",
"return",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"return",
"roles",
"."... | Get roles configuration for tenant.
Map key is ROLE_KEY and value is role.
@param tenant the tenant
@return role | [
"Get",
"roles",
"configuration",
"for",
"tenant",
".",
"Map",
"key",
"is",
"ROLE_KEY",
"and",
"value",
"is",
"role",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/RoleService.java#L37-L42 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.printExceptionWithStackInfo | public static String printExceptionWithStackInfo(Throwable throwable) {
StringBuilder out = new StringBuilder();
printExceptionWithStackInfo(throwable, out);
return out.toString();
} | java | public static String printExceptionWithStackInfo(Throwable throwable) {
StringBuilder out = new StringBuilder();
printExceptionWithStackInfo(throwable, out);
return out.toString();
} | [
"public",
"static",
"String",
"printExceptionWithStackInfo",
"(",
"Throwable",
"throwable",
")",
"{",
"StringBuilder",
"out",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"printExceptionWithStackInfo",
"(",
"throwable",
",",
"out",
")",
";",
"return",
"out",
".",
... | Builds log string for exception with stack trace.
@param throwable the exception
@return exception description string with stack trace | [
"Builds",
"log",
"string",
"for",
"exception",
"with",
"stack",
"trace",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L68-L72 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.joinUrlPaths | @SafeVarargs
public static <T> String joinUrlPaths(final T[] arr, final T... arr2) {
try {
T[] url = ArrayUtils.addAll(arr, arr2);
String res = StringUtils.join(url);
return (res == null) ? "" : res;
} catch (IndexOutOfBoundsException | IllegalArgumentException | ... | java | @SafeVarargs
public static <T> String joinUrlPaths(final T[] arr, final T... arr2) {
try {
T[] url = ArrayUtils.addAll(arr, arr2);
String res = StringUtils.join(url);
return (res == null) ? "" : res;
} catch (IndexOutOfBoundsException | IllegalArgumentException | ... | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"String",
"joinUrlPaths",
"(",
"final",
"T",
"[",
"]",
"arr",
",",
"final",
"T",
"...",
"arr2",
")",
"{",
"try",
"{",
"T",
"[",
"]",
"url",
"=",
"ArrayUtils",
".",
"addAll",
"(",
"arr",
",",
... | Join URL path into one string.
@param arr first url paths
@param arr2 other url paths
@param <T> url part path type
@return URL representation string | [
"Join",
"URL",
"path",
"into",
"one",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L110-L120 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.getCallMethod | public static String getCallMethod(JoinPoint joinPoint) {
if (joinPoint != null && joinPoint.getSignature() != null) {
Class<?> declaringType = joinPoint.getSignature().getDeclaringType();
String className = (declaringType != null) ? declaringType.getSimpleName() : PRINT_QUESTION;
... | java | public static String getCallMethod(JoinPoint joinPoint) {
if (joinPoint != null && joinPoint.getSignature() != null) {
Class<?> declaringType = joinPoint.getSignature().getDeclaringType();
String className = (declaringType != null) ? declaringType.getSimpleName() : PRINT_QUESTION;
... | [
"public",
"static",
"String",
"getCallMethod",
"(",
"JoinPoint",
"joinPoint",
")",
"{",
"if",
"(",
"joinPoint",
"!=",
"null",
"&&",
"joinPoint",
".",
"getSignature",
"(",
")",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"declaringType",
"=",
"joinPoint... | Gets method description string from join point.
@param joinPoint aspect join point
@return method description string from join point | [
"Gets",
"method",
"description",
"string",
"from",
"join",
"point",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L128-L136 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.printInputParams | public static String printInputParams(JoinPoint joinPoint, String... includeParamNames) {
try {
if (joinPoint == null) {
return "joinPoint is null";
}
Signature signature = joinPoint.getSignature();
if (!(signature instanceof MethodSignature)) {
... | java | public static String printInputParams(JoinPoint joinPoint, String... includeParamNames) {
try {
if (joinPoint == null) {
return "joinPoint is null";
}
Signature signature = joinPoint.getSignature();
if (!(signature instanceof MethodSignature)) {
... | [
"public",
"static",
"String",
"printInputParams",
"(",
"JoinPoint",
"joinPoint",
",",
"String",
"...",
"includeParamNames",
")",
"{",
"try",
"{",
"if",
"(",
"joinPoint",
"==",
"null",
")",
"{",
"return",
"\"joinPoint is null\"",
";",
"}",
"Signature",
"signature... | Gets join point input params description string.
@param joinPoint aspect join point
@param includeParamNames input parameters names to be printed. NOTE! can be overridden with @{@link
LoggingAspectConfig}
@return join point input params description string | [
"Gets",
"join",
"point",
"input",
"params",
"description",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L146-L187 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.printCollectionAware | public static String printCollectionAware(final Object object, final boolean printBody) {
if (!printBody) {
return PRINT_HIDDEN;
}
if (object == null) {
return String.valueOf(object);
}
Class<?> clazz = object.getClass();
if (!Collection.class.i... | java | public static String printCollectionAware(final Object object, final boolean printBody) {
if (!printBody) {
return PRINT_HIDDEN;
}
if (object == null) {
return String.valueOf(object);
}
Class<?> clazz = object.getClass();
if (!Collection.class.i... | [
"public",
"static",
"String",
"printCollectionAware",
"(",
"final",
"Object",
"object",
",",
"final",
"boolean",
"printBody",
")",
"{",
"if",
"(",
"!",
"printBody",
")",
"{",
"return",
"PRINT_HIDDEN",
";",
"}",
"if",
"(",
"object",
"==",
"null",
")",
"{",
... | Gets object representation with size for collection case.
@param object object instance to log
@param printBody if {@code true} then prevent object string representation
@return object representation with size for collection case | [
"Gets",
"object",
"representation",
"with",
"size",
"for",
"collection",
"case",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L297-L317 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/translator/SpelToJpqlTranslator.java | SpelToJpqlTranslator.replaceOperators | private static String replaceOperators(String spel) {
if (StringUtils.isBlank(spel)) {
return spel;
}
return spel.replaceAll("==", " = ")
.replaceAll("&&", " and ")
.replaceAll("\\|\\|", " or ");
} | java | private static String replaceOperators(String spel) {
if (StringUtils.isBlank(spel)) {
return spel;
}
return spel.replaceAll("==", " = ")
.replaceAll("&&", " and ")
.replaceAll("\\|\\|", " or ");
} | [
"private",
"static",
"String",
"replaceOperators",
"(",
"String",
"spel",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"spel",
")",
")",
"{",
"return",
"spel",
";",
"}",
"return",
"spel",
".",
"replaceAll",
"(",
"\"==\"",
",",
"\" = \"",
")",... | Replace SPEL ==, &&, || to SQL =, and, or .
@param spel the spring expression
@return sql expression | [
"Replace",
"SPEL",
"==",
"&&",
"||",
"to",
"SQL",
"=",
"and",
"or",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/translator/SpelToJpqlTranslator.java#L29-L36 | train |
xm-online/xm-commons | xm-commons-tenant/src/main/java/com/icthh/xm/commons/tenant/XmJvmSecurityUtils.java | XmJvmSecurityUtils.checkSecurity | public static void checkSecurity() {
SecurityManager securityManager = System.getSecurityManager();
if (securityManager != null) {
securityManager.checkPermission(new ManagementPermission(PERMISSION_NAME_CONTROL));
}
} | java | public static void checkSecurity() {
SecurityManager securityManager = System.getSecurityManager();
if (securityManager != null) {
securityManager.checkPermission(new ManagementPermission(PERMISSION_NAME_CONTROL));
}
} | [
"public",
"static",
"void",
"checkSecurity",
"(",
")",
"{",
"SecurityManager",
"securityManager",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"securityManager",
"!=",
"null",
")",
"{",
"securityManager",
".",
"checkPermission",
"(",
"new"... | If JVM security manager exists then checks JVM security 'control' permission. | [
"If",
"JVM",
"security",
"manager",
"exists",
"then",
"checks",
"JVM",
"security",
"control",
"permission",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-tenant/src/main/java/com/icthh/xm/commons/tenant/XmJvmSecurityUtils.java#L18-L23 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java | AbstractConfig.getString | protected final <T> String getString(final IKey<T> key) {
final Object value = config.get(key.key());
return String.valueOf(value != null ? value : key.getDefaultValue());
} | java | protected final <T> String getString(final IKey<T> key) {
final Object value = config.get(key.key());
return String.valueOf(value != null ? value : key.getDefaultValue());
} | [
"protected",
"final",
"<",
"T",
">",
"String",
"getString",
"(",
"final",
"IKey",
"<",
"T",
">",
"key",
")",
"{",
"final",
"Object",
"value",
"=",
"config",
".",
"get",
"(",
"key",
".",
"key",
"(",
")",
")",
";",
"return",
"String",
".",
"valueOf",... | returns the value as string according to given key. If no value is set, the
default value will be returned.
@param key The key to read.
@return the value as string. | [
"returns",
"the",
"value",
"as",
"string",
"according",
"to",
"given",
"key",
".",
"If",
"no",
"value",
"is",
"set",
"the",
"default",
"value",
"will",
"be",
"returned",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java#L96-L100 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java | AbstractConfig.get | @SuppressWarnings("unchecked")
@Override
public final <T> T get(final IKey<T> key) {
T value = (T) config.get(key.key());
return value != null ? value : key.getDefaultValue();
} | java | @SuppressWarnings("unchecked")
@Override
public final <T> T get(final IKey<T> key) {
T value = (T) config.get(key.key());
return value != null ? value : key.getDefaultValue();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"final",
"<",
"T",
">",
"T",
"get",
"(",
"final",
"IKey",
"<",
"T",
">",
"key",
")",
"{",
"T",
"value",
"=",
"(",
"T",
")",
"config",
".",
"get",
"(",
"key",
".",
"key... | returns the value for the given key. If no value is set, the
default value will be returned.
@param key The key to read.
@return the value. | [
"returns",
"the",
"value",
"for",
"the",
"given",
"key",
".",
"If",
"no",
"value",
"is",
"set",
"the",
"default",
"value",
"will",
"be",
"returned",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java#L109-L115 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java | AbstractConfig.newKey | protected static <T> IKey<T> newKey(final String key, final T defaultValue) {
return new Key<T>(key, defaultValue);
} | java | protected static <T> IKey<T> newKey(final String key, final T defaultValue) {
return new Key<T>(key, defaultValue);
} | [
"protected",
"static",
"<",
"T",
">",
"IKey",
"<",
"T",
">",
"newKey",
"(",
"final",
"String",
"key",
",",
"final",
"T",
"defaultValue",
")",
"{",
"return",
"new",
"Key",
"<",
"T",
">",
"(",
"key",
",",
"defaultValue",
")",
";",
"}"
] | creates a new key.
@param key string representation of this key
@param defaultValue The default value | [
"creates",
"a",
"new",
"key",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/AbstractConfig.java#L134-L136 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptConfigServerResourceLoader.java | XmLepScriptConfigServerResourceLoader.getResource | @Override
public Resource getResource(String location) {
String cfgPath = StringUtils.removeStart(location, XM_MS_CONFIG_URL_PREFIX);
return scriptResources.getOrDefault(cfgPath, XmLepScriptResource.nonExist());
} | java | @Override
public Resource getResource(String location) {
String cfgPath = StringUtils.removeStart(location, XM_MS_CONFIG_URL_PREFIX);
return scriptResources.getOrDefault(cfgPath, XmLepScriptResource.nonExist());
} | [
"@",
"Override",
"public",
"Resource",
"getResource",
"(",
"String",
"location",
")",
"{",
"String",
"cfgPath",
"=",
"StringUtils",
".",
"removeStart",
"(",
"location",
",",
"XM_MS_CONFIG_URL_PREFIX",
")",
";",
"return",
"scriptResources",
".",
"getOrDefault",
"("... | Get LEP script resource.
@param location {@code /config/tenant/{tenant-key}/{ms-name}/lep/a/b/c/SomeScript.groovy}
@return the LEP script resource | [
"Get",
"LEP",
"script",
"resource",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptConfigServerResourceLoader.java#L99-L103 | train |
xm-online/xm-commons | xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/api/AbstractConfigService.java | AbstractConfigService.updateConfigurations | @Override
public void updateConfigurations(String commit, Collection<String> paths) {
Map<String, Configuration> configurationsMap = getConfigurationMap(commit, paths);
paths.forEach(path -> notifyUpdated(configurationsMap
.getOrDefault(path, new Configuration(path, null))));
} | java | @Override
public void updateConfigurations(String commit, Collection<String> paths) {
Map<String, Configuration> configurationsMap = getConfigurationMap(commit, paths);
paths.forEach(path -> notifyUpdated(configurationsMap
.getOrDefault(path, new Configuration(path, null))));
} | [
"@",
"Override",
"public",
"void",
"updateConfigurations",
"(",
"String",
"commit",
",",
"Collection",
"<",
"String",
">",
"paths",
")",
"{",
"Map",
"<",
"String",
",",
"Configuration",
">",
"configurationsMap",
"=",
"getConfigurationMap",
"(",
"commit",
",",
... | Update configuration from config service
@param commit commit hash, will be empty if configuration deleted
@param paths collection of paths updated | [
"Update",
"configuration",
"from",
"config",
"service"
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/api/AbstractConfigService.java#L28-L33 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java | MdcUtils.generateRid | public static String generateRid() {
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());
rid = StringUtils.replaceChars(rid, "+/=", "");
return StringUtils.... | java | public static String generateRid() {
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());
rid = StringUtils.replaceChars(rid, "+/=", "");
return StringUtils.... | [
"public",
"static",
"String",
"generateRid",
"(",
")",
"{",
"byte",
"[",
"]",
"encode",
"=",
"Base64",
".",
"getEncoder",
"(",
")",
".",
"encode",
"(",
"DigestUtils",
".",
"sha256",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
... | Generates request id based on UID and SHA-256.
@return request identity | [
"Generates",
"request",
"id",
"based",
"on",
"UID",
"and",
"SHA",
"-",
"256",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java#L82-L91 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/SpringLepProcessingApplicationListener.java | SpringLepProcessingApplicationListener.onBeforeExecutionEvent | @Override
public void onBeforeExecutionEvent(BeforeExecutionEvent event) {
LepManager manager = event.getSource();
ScopedContext threadContext = manager.getContext(ContextScopes.THREAD);
if (threadContext == null) {
throw new IllegalStateException("LEP manager thread context does... | java | @Override
public void onBeforeExecutionEvent(BeforeExecutionEvent event) {
LepManager manager = event.getSource();
ScopedContext threadContext = manager.getContext(ContextScopes.THREAD);
if (threadContext == null) {
throw new IllegalStateException("LEP manager thread context does... | [
"@",
"Override",
"public",
"void",
"onBeforeExecutionEvent",
"(",
"BeforeExecutionEvent",
"event",
")",
"{",
"LepManager",
"manager",
"=",
"event",
".",
"getSource",
"(",
")",
";",
"ScopedContext",
"threadContext",
"=",
"manager",
".",
"getContext",
"(",
"ContextS... | Init execution context for script variables bindings.
@param event the BeforeExecutionEvent | [
"Init",
"execution",
"context",
"for",
"script",
"variables",
"bindings",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/SpringLepProcessingApplicationListener.java#L59-L78 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/LepServiceHandler.java | LepServiceHandler.onMethodInvoke | @SuppressWarnings("squid:S00112") //suppress throwable warning
public Object onMethodInvoke(Class<?> targetType, Object target, Method method, Object[] args) throws Throwable {
LepService typeLepService = targetType.getAnnotation(LepService.class);
Objects.requireNonNull(typeLepService, "No " + LepS... | java | @SuppressWarnings("squid:S00112") //suppress throwable warning
public Object onMethodInvoke(Class<?> targetType, Object target, Method method, Object[] args) throws Throwable {
LepService typeLepService = targetType.getAnnotation(LepService.class);
Objects.requireNonNull(typeLepService, "No " + LepS... | [
"@",
"SuppressWarnings",
"(",
"\"squid:S00112\"",
")",
"//suppress throwable warning",
"public",
"Object",
"onMethodInvoke",
"(",
"Class",
"<",
"?",
">",
"targetType",
",",
"Object",
"target",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throw... | Processes a LEP method invocation on a proxy instance and returns
the result. This method will be invoked on an invocation handler
when a method is invoked on a proxy instance that it is
associated with.
@param targetType type of LEP service (interface, concrete class)
@param target target LEP service object, can... | [
"Processes",
"a",
"LEP",
"method",
"invocation",
"on",
"a",
"proxy",
"instance",
"and",
"returns",
"the",
"result",
".",
"This",
"method",
"will",
"be",
"invoked",
"on",
"an",
"invocation",
"handler",
"when",
"a",
"method",
"is",
"invoked",
"on",
"a",
"pro... | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/spring/LepServiceHandler.java#L64-L91 | train |
xm-online/xm-commons | xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/repository/kafka/ConfigTopicConsumer.java | ConfigTopicConsumer.consumeEvent | @Retryable(maxAttemptsExpression = "${application.retry.max-attempts}",
backoff = @Backoff(delayExpression = "${application.retry.delay}",
multiplierExpression = "${application.retry.multiplier}"))
public void consumeEvent(ConsumerRecord<String, String> message) {
MdcUtils.putRid();
... | java | @Retryable(maxAttemptsExpression = "${application.retry.max-attempts}",
backoff = @Backoff(delayExpression = "${application.retry.delay}",
multiplierExpression = "${application.retry.multiplier}"))
public void consumeEvent(ConsumerRecord<String, String> message) {
MdcUtils.putRid();
... | [
"@",
"Retryable",
"(",
"maxAttemptsExpression",
"=",
"\"${application.retry.max-attempts}\"",
",",
"backoff",
"=",
"@",
"Backoff",
"(",
"delayExpression",
"=",
"\"${application.retry.delay}\"",
",",
"multiplierExpression",
"=",
"\"${application.retry.multiplier}\"",
")",
")",... | Consume tenant command event message.
@param message the tenant command event message | [
"Consume",
"tenant",
"command",
"event",
"message",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-config/src/main/java/com/icthh/xm/commons/config/client/repository/kafka/ConfigTopicConsumer.java#L32-L51 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/LepScriptUtils.java | LepScriptUtils.executeScript | static Object executeScript(UrlLepResourceKey scriptResourceKey,
ProceedingLep proceedingLep, // can be null
LepMethod method,
LepManagerService managerService,
Supplier<GroovyScriptRunner> re... | java | static Object executeScript(UrlLepResourceKey scriptResourceKey,
ProceedingLep proceedingLep, // can be null
LepMethod method,
LepManagerService managerService,
Supplier<GroovyScriptRunner> re... | [
"static",
"Object",
"executeScript",
"(",
"UrlLepResourceKey",
"scriptResourceKey",
",",
"ProceedingLep",
"proceedingLep",
",",
"// can be null",
"LepMethod",
"method",
",",
"LepManagerService",
"managerService",
",",
"Supplier",
"<",
"GroovyScriptRunner",
">",
"resourceExe... | Executes any script.
@param scriptResourceKey current script resource key
@param proceedingLep method proceed for Around scripts
@param method LEP method
@param managerService LEP manager service
@param resourceExecutorSupplier LEP resource script executor supplier
@param ... | [
"Executes",
"any",
"script",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/LepScriptUtils.java#L37-L53 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/LepScriptUtils.java | LepScriptUtils.buildBinding | private static Binding buildBinding(UrlLepResourceKey scriptResourceKey,
LepManagerService managerService,
LepMethod method,
ProceedingLep proceedingLep,
LepMet... | java | private static Binding buildBinding(UrlLepResourceKey scriptResourceKey,
LepManagerService managerService,
LepMethod method,
ProceedingLep proceedingLep,
LepMet... | [
"private",
"static",
"Binding",
"buildBinding",
"(",
"UrlLepResourceKey",
"scriptResourceKey",
",",
"LepManagerService",
"managerService",
",",
"LepMethod",
"method",
",",
"ProceedingLep",
"proceedingLep",
",",
"LepMethodResult",
"lepMethodResult",
",",
"Object",
"...",
"... | Build scripts bindings.
@param scriptResourceKey current script resource key
@param managerService LEP manager service
@param method LEP method
@param proceedingLep proceeding object (can be {@code null})
@param overrodeArgValues arg values to override (can be {@code null})
@return Groovy script bind... | [
"Build",
"scripts",
"bindings",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/LepScriptUtils.java#L65-L117 | train |
xm-online/xm-commons | xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java | OAuth2JwtAccessTokenConverter.decode | @Override
protected Map<String, Object> decode(String token) {
try {
//check if our public key and thus SignatureVerifier have expired
long ttl = oAuth2Properties.getSignatureVerification().getTtl();
if (ttl > 0 && System.currentTimeMillis() - lastKeyFetchTimestamp > ttl)... | java | @Override
protected Map<String, Object> decode(String token) {
try {
//check if our public key and thus SignatureVerifier have expired
long ttl = oAuth2Properties.getSignatureVerification().getTtl();
if (ttl > 0 && System.currentTimeMillis() - lastKeyFetchTimestamp > ttl)... | [
"@",
"Override",
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"decode",
"(",
"String",
"token",
")",
"{",
"try",
"{",
"//check if our public key and thus SignatureVerifier have expired",
"long",
"ttl",
"=",
"oAuth2Properties",
".",
"getSignatureVerification",
... | Try to decode the token with the current public key.
If it fails, contact the OAuth2 server to get a new public key, then try again.
We might not have fetched it in the first place or it might have changed.
@param token the JWT token to decode.
@return the resulting claims.
@throws InvalidTokenException if we cannot d... | [
"Try",
"to",
"decode",
"the",
"token",
"with",
"the",
"current",
"public",
"key",
".",
"If",
"it",
"fails",
"contact",
"the",
"OAuth2",
"server",
"to",
"get",
"a",
"new",
"public",
"key",
"then",
"try",
"again",
".",
"We",
"might",
"not",
"have",
"fetc... | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java#L41-L56 | train |
xm-online/xm-commons | xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java | OAuth2JwtAccessTokenConverter.tryCreateSignatureVerifier | private boolean tryCreateSignatureVerifier() {
long t = System.currentTimeMillis();
if (t - lastKeyFetchTimestamp < oAuth2Properties.getSignatureVerification().getPublicKeyRefreshRateLimit()) {
return false;
}
try {
SignatureVerifier verifier = signatureVerifierCl... | java | private boolean tryCreateSignatureVerifier() {
long t = System.currentTimeMillis();
if (t - lastKeyFetchTimestamp < oAuth2Properties.getSignatureVerification().getPublicKeyRefreshRateLimit()) {
return false;
}
try {
SignatureVerifier verifier = signatureVerifierCl... | [
"private",
"boolean",
"tryCreateSignatureVerifier",
"(",
")",
"{",
"long",
"t",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"t",
"-",
"lastKeyFetchTimestamp",
"<",
"oAuth2Properties",
".",
"getSignatureVerification",
"(",
")",
".",
"getPub... | Fetch a new public key from the AuthorizationServer.
@return true, if we could fetch it; false, if we could not. | [
"Fetch",
"a",
"new",
"public",
"key",
"from",
"the",
"AuthorizationServer",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java#L63-L80 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/WicketJquerySelectors.java | WicketJquerySelectors.install | public static void install(Application app, IWicketJquerySelectorsSettings settings) {
final IWicketJquerySelectorsSettings existingSettings = settings(app);
if (existingSettings == null) {
if (settings == null) {
settings = new WicketJquerySelectorsSettings();
}... | java | public static void install(Application app, IWicketJquerySelectorsSettings settings) {
final IWicketJquerySelectorsSettings existingSettings = settings(app);
if (existingSettings == null) {
if (settings == null) {
settings = new WicketJquerySelectorsSettings();
}... | [
"public",
"static",
"void",
"install",
"(",
"Application",
"app",
",",
"IWicketJquerySelectorsSettings",
"settings",
")",
"{",
"final",
"IWicketJquerySelectorsSettings",
"existingSettings",
"=",
"settings",
"(",
"app",
")",
";",
"if",
"(",
"existingSettings",
"==",
... | installs the library settings to given app.
@param app the wicket application
@param settings the settings to use | [
"installs",
"the",
"library",
"settings",
"to",
"given",
"app",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/WicketJquerySelectors.java#L49-L61 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java | PrivilegeMapper.privilegesToYml | public String privilegesToYml(Collection<Privilege> privileges) {
try {
Map<String, Set<Privilege>> map = new TreeMap<>();
privileges.forEach(privilege -> {
map.putIfAbsent(privilege.getMsName(), new TreeSet<>());
map.get(privilege.getMsName()).add(privile... | java | public String privilegesToYml(Collection<Privilege> privileges) {
try {
Map<String, Set<Privilege>> map = new TreeMap<>();
privileges.forEach(privilege -> {
map.putIfAbsent(privilege.getMsName(), new TreeSet<>());
map.get(privilege.getMsName()).add(privile... | [
"public",
"String",
"privilegesToYml",
"(",
"Collection",
"<",
"Privilege",
">",
"privileges",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Set",
"<",
"Privilege",
">",
">",
"map",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"privileges",
".",
"fo... | Convert privileges collection to yml string.
@param privileges collection
@return yml string | [
"Convert",
"privileges",
"collection",
"to",
"yml",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java#L29-L41 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java | PrivilegeMapper.privilegesMapToYml | public String privilegesMapToYml(Map<String, Collection<Privilege>> privileges) {
try {
return mapper.writeValueAsString(privileges);
} catch (Exception e) {
log.error("Failed to create privileges YML file from map, error: {}", e.getMessage(), e);
}
return null;
... | java | public String privilegesMapToYml(Map<String, Collection<Privilege>> privileges) {
try {
return mapper.writeValueAsString(privileges);
} catch (Exception e) {
log.error("Failed to create privileges YML file from map, error: {}", e.getMessage(), e);
}
return null;
... | [
"public",
"String",
"privilegesMapToYml",
"(",
"Map",
"<",
"String",
",",
"Collection",
"<",
"Privilege",
">",
">",
"privileges",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"writeValueAsString",
"(",
"privileges",
")",
";",
"}",
"catch",
"(",
"Exception"... | Convert privileges map to yml string.
@param privileges map
@return yml string | [
"Convert",
"privileges",
"map",
"to",
"yml",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java#L49-L56 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java | PrivilegeMapper.ymlToPrivileges | public Map<String, Set<Privilege>> ymlToPrivileges(String yml) {
try {
Map<String, Set<Privilege>> map = mapper.readValue(yml,
new TypeReference<TreeMap<String, TreeSet<Privilege>>>() {
});
map.forEach((msName, privileges) -> privileges.forEach(privilege -... | java | public Map<String, Set<Privilege>> ymlToPrivileges(String yml) {
try {
Map<String, Set<Privilege>> map = mapper.readValue(yml,
new TypeReference<TreeMap<String, TreeSet<Privilege>>>() {
});
map.forEach((msName, privileges) -> privileges.forEach(privilege -... | [
"public",
"Map",
"<",
"String",
",",
"Set",
"<",
"Privilege",
">",
">",
"ymlToPrivileges",
"(",
"String",
"yml",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Set",
"<",
"Privilege",
">",
">",
"map",
"=",
"mapper",
".",
"readValue",
"(",
"yml",
... | Convert privileges yml string to map.
@param yml string
@return privileges map | [
"Convert",
"privileges",
"yml",
"string",
"to",
"map",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PrivilegeMapper.java#L64-L75 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.fromJson | public static <T> T fromJson(final String json, final JavaType type) {
try {
return createObjectMapper().readValue(json, type);
} catch (Exception e) {
throw new ParseException(e);
}
} | java | public static <T> T fromJson(final String json, final JavaType type) {
try {
return createObjectMapper().readValue(json, type);
} catch (Exception e) {
throw new ParseException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"final",
"String",
"json",
",",
"final",
"JavaType",
"type",
")",
"{",
"try",
"{",
"return",
"createObjectMapper",
"(",
")",
".",
"readValue",
"(",
"json",
",",
"type",
")",
";",
"}",
"catch",
... | Convert a string to a Java value
@param json Json value to convert.
@param type Expected Java value type.
@param <T> type of return object
@return casted value of given json object
@throws ParseException to runtime if json node can't be casted to clazz. | [
"Convert",
"a",
"string",
"to",
"a",
"Java",
"value"
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L44-L50 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.toJson | public static JsonNode toJson(final Object data) {
if (data == null) {
return newObject();
}
try {
return createObjectMapper().valueToTree(data);
} catch (Exception e) {
throw new ParseException(e);
}
} | java | public static JsonNode toJson(final Object data) {
if (data == null) {
return newObject();
}
try {
return createObjectMapper().valueToTree(data);
} catch (Exception e) {
throw new ParseException(e);
}
} | [
"public",
"static",
"JsonNode",
"toJson",
"(",
"final",
"Object",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"newObject",
"(",
")",
";",
"}",
"try",
"{",
"return",
"createObjectMapper",
"(",
")",
".",
"valueToTree",
"(",
"da... | Convert an object to JsonNode.
@param data Value to convert in Json.
@return creates a new json object from given data object
@throws ParseException to runtime if object can't be parsed | [
"Convert",
"an",
"object",
"to",
"JsonNode",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L67-L77 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.stringify | public static String stringify(final JsonNode json) {
try {
return json != null ? createObjectMapper().writeValueAsString(json) : "{}";
} catch (JsonProcessingException jpx) {
throw new RuntimeException("A problem occurred while stringifying a JsonNode: " + jpx.getMessage(), jpx)... | java | public static String stringify(final JsonNode json) {
try {
return json != null ? createObjectMapper().writeValueAsString(json) : "{}";
} catch (JsonProcessingException jpx) {
throw new RuntimeException("A problem occurred while stringifying a JsonNode: " + jpx.getMessage(), jpx)... | [
"public",
"static",
"String",
"stringify",
"(",
"final",
"JsonNode",
"json",
")",
"{",
"try",
"{",
"return",
"json",
"!=",
"null",
"?",
"createObjectMapper",
"(",
")",
".",
"writeValueAsString",
"(",
"json",
")",
":",
"\"{}\"",
";",
"}",
"catch",
"(",
"J... | Convert a JsonNode to its string representation. If given
value is null an empty json object will returned.
@param json The json object to toJsonString
@return stringified version of given json object | [
"Convert",
"a",
"JsonNode",
"to",
"its",
"string",
"representation",
".",
"If",
"given",
"value",
"is",
"null",
"an",
"empty",
"json",
"object",
"will",
"returned",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L124-L130 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.isValid | public static boolean isValid(final String json) {
if (Strings.isEmpty(json)) {
return false;
}
try {
return parse(json) != null;
} catch (ParseException e) {
return false;
}
} | java | public static boolean isValid(final String json) {
if (Strings.isEmpty(json)) {
return false;
}
try {
return parse(json) != null;
} catch (ParseException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"final",
"String",
"json",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"json",
")",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"return",
"parse",
"(",
"json",
")",
"!=",
"null",
";",
"... | verifies a valid json string
@param json The json string
@return true, if string is a valid json string | [
"verifies",
"a",
"valid",
"json",
"string"
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L149-L159 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Json.java | Json.parse | public static JsonNode parse(final String jsonString) {
if (Strings.isEmpty(jsonString)) {
return newObject();
}
try {
return createObjectMapper().readValue(jsonString, JsonNode.class);
} catch (Throwable e) {
throw new ParseException(String.format("c... | java | public static JsonNode parse(final String jsonString) {
if (Strings.isEmpty(jsonString)) {
return newObject();
}
try {
return createObjectMapper().readValue(jsonString, JsonNode.class);
} catch (Throwable e) {
throw new ParseException(String.format("c... | [
"public",
"static",
"JsonNode",
"parse",
"(",
"final",
"String",
"jsonString",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"jsonString",
")",
")",
"{",
"return",
"newObject",
"(",
")",
";",
"}",
"try",
"{",
"return",
"createObjectMapper",
"(",
"... | Parse a String representing a json, and return it as a JsonNode.
@param jsonString string to parse
@return parsed json string as json node
@throws ParseException to runtime if json string can't be parsed | [
"Parse",
"a",
"String",
"representing",
"a",
"json",
"and",
"return",
"it",
"as",
"a",
"JsonNode",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L168-L178 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptRules.java | XmLepScriptRules.validateScriptsCombination | public static void validateScriptsCombination(Set<XmLepResourceSubType> scriptTypes,
LepMethod lepMethod,
UrlLepResourceKey compositeResourceKey) {
byte mask = getCombinationMask(scriptTypes, lepMethod, composite... | java | public static void validateScriptsCombination(Set<XmLepResourceSubType> scriptTypes,
LepMethod lepMethod,
UrlLepResourceKey compositeResourceKey) {
byte mask = getCombinationMask(scriptTypes, lepMethod, composite... | [
"public",
"static",
"void",
"validateScriptsCombination",
"(",
"Set",
"<",
"XmLepResourceSubType",
">",
"scriptTypes",
",",
"LepMethod",
"lepMethod",
",",
"UrlLepResourceKey",
"compositeResourceKey",
")",
"{",
"byte",
"mask",
"=",
"getCombinationMask",
"(",
"scriptTypes... | Validate script combination.
@param scriptTypes current point script types
@param lepMethod executed LEP method
@param compositeResourceKey used only for informative exception message | [
"Validate",
"script",
"combination",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptRules.java#L36-L77 | train |
xm-online/xm-commons | xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptRules.java | XmLepScriptRules.getCombinationMask | private static byte getCombinationMask(Set<XmLepResourceSubType> scriptTypes,
LepMethod lepMethod,
UrlLepResourceKey compositeResourceKey) {
byte combinationMask = 0;
for (XmLepResourceSubType scriptType : scriptTypes)... | java | private static byte getCombinationMask(Set<XmLepResourceSubType> scriptTypes,
LepMethod lepMethod,
UrlLepResourceKey compositeResourceKey) {
byte combinationMask = 0;
for (XmLepResourceSubType scriptType : scriptTypes)... | [
"private",
"static",
"byte",
"getCombinationMask",
"(",
"Set",
"<",
"XmLepResourceSubType",
">",
"scriptTypes",
",",
"LepMethod",
"lepMethod",
",",
"UrlLepResourceKey",
"compositeResourceKey",
")",
"{",
"byte",
"combinationMask",
"=",
"0",
";",
"for",
"(",
"XmLepRes... | Builds script combination mask.
@param scriptTypes current point script types
@param lepMethod executed LEP method
@param compositeResourceKey used only for informative exception message
@return available scripts mask for current LEP | [
"Builds",
"script",
"combination",
"mask",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-lep/src/main/java/com/icthh/xm/commons/lep/XmLepScriptRules.java#L95-L134 | train |
xm-online/xm-commons | xm-commons-timeline/src/main/java/com/icthh/xm/commons/timeline/TimelineEventProducer.java | TimelineEventProducer.createEventJson | public String createEventJson(HttpServletRequest request,
HttpServletResponse response,
String tenant,
String userLogin,
String userKey) {
try {
String requestBody ... | java | public String createEventJson(HttpServletRequest request,
HttpServletResponse response,
String tenant,
String userLogin,
String userKey) {
try {
String requestBody ... | [
"public",
"String",
"createEventJson",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"tenant",
",",
"String",
"userLogin",
",",
"String",
"userKey",
")",
"{",
"try",
"{",
"String",
"requestBody",
"=",
"getRequestContent... | Create event json string.
@param request the http request
@param response the http response | [
"Create",
"event",
"json",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-timeline/src/main/java/com/icthh/xm/commons/timeline/TimelineEventProducer.java#L60-L101 | train |
xm-online/xm-commons | xm-commons-timeline/src/main/java/com/icthh/xm/commons/timeline/TimelineEventProducer.java | TimelineEventProducer.send | @Async
public void send(String topic, String content) {
try {
if (!StringUtils.isBlank(content)) {
log.debug("Sending kafka event with data {} to topic {}", content, topic);
template.send(topic, content);
}
} catch (Exception e) {
l... | java | @Async
public void send(String topic, String content) {
try {
if (!StringUtils.isBlank(content)) {
log.debug("Sending kafka event with data {} to topic {}", content, topic);
template.send(topic, content);
}
} catch (Exception e) {
l... | [
"@",
"Async",
"public",
"void",
"send",
"(",
"String",
"topic",
",",
"String",
"content",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"content",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Sending kafka event with data {} to t... | Send event to kafka.
@param topic the kafka topic
@param content the event content | [
"Send",
"event",
"to",
"kafka",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-timeline/src/main/java/com/icthh/xm/commons/timeline/TimelineEventProducer.java#L109-L120 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/util/Generics2.java | Generics2.join | public static String join(final Iterable<?> elements, final char separator) {
return Joiner.on(separator).skipNulls().join(elements);
} | java | public static String join(final Iterable<?> elements, final char separator) {
return Joiner.on(separator).skipNulls().join(elements);
} | [
"public",
"static",
"String",
"join",
"(",
"final",
"Iterable",
"<",
"?",
">",
"elements",
",",
"final",
"char",
"separator",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"separator",
")",
".",
"skipNulls",
"(",
")",
".",
"join",
"(",
"elements",
")",... | joins all given elements with a special separator
@param elements elements to join
@param separator separator to use
@return elements as string | [
"joins",
"all",
"given",
"elements",
"with",
"a",
"special",
"separator"
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Generics2.java#L92-L94 | train |
xm-online/xm-commons | xm-commons-ms-web/src/main/java/com/icthh/xm/commons/web/spring/config/XmWebMvcConfigurerAdapter.java | XmWebMvcConfigurerAdapter.registerTenantInterceptorWithIgnorePathPattern | protected void registerTenantInterceptorWithIgnorePathPattern(
InterceptorRegistry registry, HandlerInterceptor interceptor) {
InterceptorRegistration tenantInterceptorRegistration = registry.addInterceptor(interceptor);
tenantInterceptorRegistration.addPathPatterns("/**");
... | java | protected void registerTenantInterceptorWithIgnorePathPattern(
InterceptorRegistry registry, HandlerInterceptor interceptor) {
InterceptorRegistration tenantInterceptorRegistration = registry.addInterceptor(interceptor);
tenantInterceptorRegistration.addPathPatterns("/**");
... | [
"protected",
"void",
"registerTenantInterceptorWithIgnorePathPattern",
"(",
"InterceptorRegistry",
"registry",
",",
"HandlerInterceptor",
"interceptor",
")",
"{",
"InterceptorRegistration",
"tenantInterceptorRegistration",
"=",
"registry",
".",
"addInterceptor",
"(",
"interceptor... | Registered interceptor to all request except passed urls.
@param registry helps with configuring a list of mapped interceptors.
@param interceptor the interceptor | [
"Registered",
"interceptor",
"to",
"all",
"request",
"except",
"passed",
"urls",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-ms-web/src/main/java/com/icthh/xm/commons/web/spring/config/XmWebMvcConfigurerAdapter.java#L81-L95 | train |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/AopAnnotationUtils.java | AopAnnotationUtils.getConfigAnnotation | public static Optional<LoggingAspectConfig> getConfigAnnotation(JoinPoint joinPoint) {
Optional<Method> method = getCallingMethod(joinPoint);
Optional<LoggingAspectConfig> result = method
.map(m -> AnnotationUtils.findAnnotation(m, LoggingAspectConfig.class));
if (!result.isPresen... | java | public static Optional<LoggingAspectConfig> getConfigAnnotation(JoinPoint joinPoint) {
Optional<Method> method = getCallingMethod(joinPoint);
Optional<LoggingAspectConfig> result = method
.map(m -> AnnotationUtils.findAnnotation(m, LoggingAspectConfig.class));
if (!result.isPresen... | [
"public",
"static",
"Optional",
"<",
"LoggingAspectConfig",
">",
"getConfigAnnotation",
"(",
"JoinPoint",
"joinPoint",
")",
"{",
"Optional",
"<",
"Method",
">",
"method",
"=",
"getCallingMethod",
"(",
"joinPoint",
")",
";",
"Optional",
"<",
"LoggingAspectConfig",
... | Find annotation related to method intercepted by joinPoint.
Annotation is searched on method level at first and then if not found on class lever as well.
Method uses spring {@link AnnotationUtils} findAnnotation(), so it is search for annotation by class hierarchy.
@param joinPoint join point
@return Optional value ... | [
"Find",
"annotation",
"related",
"to",
"method",
"intercepted",
"by",
"joinPoint",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/AopAnnotationUtils.java#L30-L43 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/RoleMapper.java | RoleMapper.rolesToYml | public String rolesToYml(Collection<Role> roles) {
try {
Map<String, Role> map = new TreeMap<>();
roles.forEach(role -> map.put(role.getKey(), role));
return mapper.writeValueAsString(map);
} catch (Exception e) {
log.error("Failed to create roles YML file... | java | public String rolesToYml(Collection<Role> roles) {
try {
Map<String, Role> map = new TreeMap<>();
roles.forEach(role -> map.put(role.getKey(), role));
return mapper.writeValueAsString(map);
} catch (Exception e) {
log.error("Failed to create roles YML file... | [
"public",
"String",
"rolesToYml",
"(",
"Collection",
"<",
"Role",
">",
"roles",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Role",
">",
"map",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"roles",
".",
"forEach",
"(",
"role",
"->",
"map",
".",... | Convert roles collection to yml string.
@param roles collection
@return yml string | [
"Convert",
"roles",
"collection",
"to",
"yml",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/RoleMapper.java#L27-L36 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/RoleMapper.java | RoleMapper.ymlToRoles | public Map<String, Role> ymlToRoles(String yml) {
try {
Map<String, Role> map = mapper
.readValue(yml, new TypeReference<TreeMap<String, Role>>() {
});
map.forEach((roleKey, role) -> role.setKey(roleKey));
return map;
} catch (Exception... | java | public Map<String, Role> ymlToRoles(String yml) {
try {
Map<String, Role> map = mapper
.readValue(yml, new TypeReference<TreeMap<String, Role>>() {
});
map.forEach((roleKey, role) -> role.setKey(roleKey));
return map;
} catch (Exception... | [
"public",
"Map",
"<",
"String",
",",
"Role",
">",
"ymlToRoles",
"(",
"String",
"yml",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Role",
">",
"map",
"=",
"mapper",
".",
"readValue",
"(",
"yml",
",",
"new",
"TypeReference",
"<",
"TreeMap",
"<",
... | Convert roles yml string to map.
@param yml string
@return roles map | [
"Convert",
"roles",
"yml",
"string",
"to",
"map",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/RoleMapper.java#L44-L55 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java | PermissionCheckService.hasPermission | public boolean hasPermission(Authentication authentication,
Object privilege) {
return checkRole(authentication, privilege, true)
|| checkPermission(authentication, null, privilege, false, true);
} | java | public boolean hasPermission(Authentication authentication,
Object privilege) {
return checkRole(authentication, privilege, true)
|| checkPermission(authentication, null, privilege, false, true);
} | [
"public",
"boolean",
"hasPermission",
"(",
"Authentication",
"authentication",
",",
"Object",
"privilege",
")",
"{",
"return",
"checkRole",
"(",
"authentication",
",",
"privilege",
",",
"true",
")",
"||",
"checkPermission",
"(",
"authentication",
",",
"null",
",",... | Check permission for role and privilege key only.
@param authentication the authentication
@param privilege the privilege key
@return true if permitted | [
"Check",
"permission",
"for",
"role",
"and",
"privilege",
"key",
"only",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L55-L59 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java | PermissionCheckService.hasPermission | public boolean hasPermission(Authentication authentication,
Object resource,
Object privilege) {
boolean logPermission = isLogPermission(resource);
return checkRole(authentication, privilege, logPermission)
|| checkPermission(... | java | public boolean hasPermission(Authentication authentication,
Object resource,
Object privilege) {
boolean logPermission = isLogPermission(resource);
return checkRole(authentication, privilege, logPermission)
|| checkPermission(... | [
"public",
"boolean",
"hasPermission",
"(",
"Authentication",
"authentication",
",",
"Object",
"resource",
",",
"Object",
"privilege",
")",
"{",
"boolean",
"logPermission",
"=",
"isLogPermission",
"(",
"resource",
")",
";",
"return",
"checkRole",
"(",
"authentication... | Check permission for role, privilege key and resource condition.
@param authentication the authentication
@param resource the resource
@param privilege the privilege key
@return true if permitted | [
"Check",
"permission",
"for",
"role",
"privilege",
"key",
"and",
"resource",
"condition",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L68-L74 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java | PermissionCheckService.hasPermission | @SuppressWarnings("unchecked")
public boolean hasPermission(Authentication authentication,
Serializable resource,
String resourceType,
Object privilege) {
boolean logPermission = isLogPermission(resource);
... | java | @SuppressWarnings("unchecked")
public boolean hasPermission(Authentication authentication,
Serializable resource,
String resourceType,
Object privilege) {
boolean logPermission = isLogPermission(resource);
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"boolean",
"hasPermission",
"(",
"Authentication",
"authentication",
",",
"Serializable",
"resource",
",",
"String",
"resourceType",
",",
"Object",
"privilege",
")",
"{",
"boolean",
"logPermission",
"=",
... | Check permission for role, privilege key, new resource and old resource.
@param authentication the authentication
@param resource the old resource
@param resourceType the resource type
@param privilege the privilege key
@return true if permitted | [
"Check",
"permission",
"for",
"role",
"privilege",
"key",
"new",
"resource",
"and",
"old",
"resource",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L84-L101 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java | PermissionCheckService.createCondition | public String createCondition(Authentication authentication, Object privilegeKey, SpelTranslator translator) {
if (!hasPermission(authentication, privilegeKey)) {
throw new AccessDeniedException("Access is denied");
}
String roleKey = getRoleKey(authentication);
Permission ... | java | public String createCondition(Authentication authentication, Object privilegeKey, SpelTranslator translator) {
if (!hasPermission(authentication, privilegeKey)) {
throw new AccessDeniedException("Access is denied");
}
String roleKey = getRoleKey(authentication);
Permission ... | [
"public",
"String",
"createCondition",
"(",
"Authentication",
"authentication",
",",
"Object",
"privilegeKey",
",",
"SpelTranslator",
"translator",
")",
"{",
"if",
"(",
"!",
"hasPermission",
"(",
"authentication",
",",
"privilegeKey",
")",
")",
"{",
"throw",
"new"... | Create condition with replaced subject variables.
<p>SpEL condition translated to SQL condition with replacing #returnObject to returnObject
and enriching #subject.* from Subject object (see {@link Subject}).
<p>As an option, SpEL could be translated to SQL
via {@link SpelExpression} method {@code getAST()}
with trav... | [
"Create",
"condition",
"with",
"replaced",
"subject",
"variables",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L118-L134 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/settings/DefaultObjectMapperFactory.java | DefaultObjectMapperFactory.addSerializer | protected Module addSerializer(SimpleModule module) {
module.addSerializer(ConfigModel.class, Holder.CONFIG_MODEL_SERIALIZER);
module.addSerializer(Config.class, Holder.CONFIG_SERIALIZER);
module.addSerializer(Json.RawValue.class, Holder.RAW_VALUE_SERIALIZER);
return module;
} | java | protected Module addSerializer(SimpleModule module) {
module.addSerializer(ConfigModel.class, Holder.CONFIG_MODEL_SERIALIZER);
module.addSerializer(Config.class, Holder.CONFIG_SERIALIZER);
module.addSerializer(Json.RawValue.class, Holder.RAW_VALUE_SERIALIZER);
return module;
} | [
"protected",
"Module",
"addSerializer",
"(",
"SimpleModule",
"module",
")",
"{",
"module",
".",
"addSerializer",
"(",
"ConfigModel",
".",
"class",
",",
"Holder",
".",
"CONFIG_MODEL_SERIALIZER",
")",
";",
"module",
".",
"addSerializer",
"(",
"Config",
".",
"class... | adds custom serializers to given module
@param module the module to extend
@return module instance for chaining | [
"adds",
"custom",
"serializers",
"to",
"given",
"module"
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/settings/DefaultObjectMapperFactory.java#L63-L69 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/settings/DefaultObjectMapperFactory.java | DefaultObjectMapperFactory.configure | protected ObjectMapper configure(ObjectMapper mapper) {
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
return mapper;
} | java | protected ObjectMapper configure(ObjectMapper mapper) {
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
return mapper;
} | [
"protected",
"ObjectMapper",
"configure",
"(",
"ObjectMapper",
"mapper",
")",
"{",
"mapper",
".",
"configure",
"(",
"JsonParser",
".",
"Feature",
".",
"ALLOW_SINGLE_QUOTES",
",",
"true",
")",
";",
"mapper",
".",
"configure",
"(",
"JsonParser",
".",
"Feature",
... | configures given object mapper instance.
@param mapper the object to configure
@return mapper instance for chaining | [
"configures",
"given",
"object",
"mapper",
"instance",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/settings/DefaultObjectMapperFactory.java#L77-L82 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PermissionMapper.java | PermissionMapper.permissionsToYml | public String permissionsToYml(Collection<Permission> permissions) {
try {
Map<String, Map<String, Set<Permission>>> map = new TreeMap<>();
permissions.forEach(permission -> {
map.putIfAbsent(permission.getMsName(), new TreeMap<>());
map.get(permission.get... | java | public String permissionsToYml(Collection<Permission> permissions) {
try {
Map<String, Map<String, Set<Permission>>> map = new TreeMap<>();
permissions.forEach(permission -> {
map.putIfAbsent(permission.getMsName(), new TreeMap<>());
map.get(permission.get... | [
"public",
"String",
"permissionsToYml",
"(",
"Collection",
"<",
"Permission",
">",
"permissions",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"Permission",
">",
">",
">",
"map",
"=",
"new",
"TreeMap",
"<>",
"... | Convert permissions collection to yml string.
@param permissions collection
@return yml string | [
"Convert",
"permissions",
"collection",
"to",
"yml",
"string",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PermissionMapper.java#L30-L43 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PermissionMapper.java | PermissionMapper.ymlToPermissions | public Map<String, Permission> ymlToPermissions(String yml, String msName) {
Map<String, Permission> result = new TreeMap<>();
try {
Map<String, Map<String, Set<Permission>>> map = mapper
.readValue(yml, new TypeReference<TreeMap<String, TreeMap<String, TreeSet<Permission>>>>... | java | public Map<String, Permission> ymlToPermissions(String yml, String msName) {
Map<String, Permission> result = new TreeMap<>();
try {
Map<String, Map<String, Set<Permission>>> map = mapper
.readValue(yml, new TypeReference<TreeMap<String, TreeMap<String, TreeSet<Permission>>>>... | [
"public",
"Map",
"<",
"String",
",",
"Permission",
">",
"ymlToPermissions",
"(",
"String",
"yml",
",",
"String",
"msName",
")",
"{",
"Map",
"<",
"String",
",",
"Permission",
">",
"result",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"try",
"{",
"Map",
... | Convert permissions yml string to map with role and privilege keys.
Return map fo specific service or all.
@param yml string
@param msName service name
@return permissions map | [
"Convert",
"permissions",
"yml",
"string",
"to",
"map",
"with",
"role",
"and",
"privilege",
"keys",
".",
"Return",
"map",
"fo",
"specific",
"service",
"or",
"all",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/domain/mapper/PermissionMapper.java#L63-L84 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java | PermittedRepository.findAll | public <T> List<T> findAll(Class<T> entityClass, String privilegeKey) {
return findAll(null, entityClass, privilegeKey).getContent();
} | java | public <T> List<T> findAll(Class<T> entityClass, String privilegeKey) {
return findAll(null, entityClass, privilegeKey).getContent();
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findAll",
"(",
"Class",
"<",
"T",
">",
"entityClass",
",",
"String",
"privilegeKey",
")",
"{",
"return",
"findAll",
"(",
"null",
",",
"entityClass",
",",
"privilegeKey",
")",
".",
"getContent",
"(",
")",... | Find all permitted entities.
@param entityClass the entity class to get
@param privilegeKey the privilege key for permission lookup
@param <T> the type of entity
@return list of permitted entities | [
"Find",
"all",
"permitted",
"entities",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java#L60-L62 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java | PermittedRepository.findAll | public <T> Page<T> findAll(Pageable pageable, Class<T> entityClass, String privilegeKey) {
String selectSql = format(SELECT_ALL_SQL, entityClass.getSimpleName());
String countSql = format(COUNT_ALL_SQL, entityClass.getSimpleName());
String permittedCondition = createPermissionCondition(privileg... | java | public <T> Page<T> findAll(Pageable pageable, Class<T> entityClass, String privilegeKey) {
String selectSql = format(SELECT_ALL_SQL, entityClass.getSimpleName());
String countSql = format(COUNT_ALL_SQL, entityClass.getSimpleName());
String permittedCondition = createPermissionCondition(privileg... | [
"public",
"<",
"T",
">",
"Page",
"<",
"T",
">",
"findAll",
"(",
"Pageable",
"pageable",
",",
"Class",
"<",
"T",
">",
"entityClass",
",",
"String",
"privilegeKey",
")",
"{",
"String",
"selectSql",
"=",
"format",
"(",
"SELECT_ALL_SQL",
",",
"entityClass",
... | Find all pageable permitted entities.
@param pageable the page info
@param entityClass the entity class to get
@param privilegeKey the privilege key for permission lookup
@param <T> the type of entity
@return page of permitted entities | [
"Find",
"all",
"pageable",
"permitted",
"entities",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java#L72-L85 | train |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java | PermittedRepository.findByCondition | public <T> Page<T> findByCondition(String whereCondition,
Map<String, Object> conditionParams,
Collection<String> embed,
Pageable pageable,
Class<T> entityClass... | java | public <T> Page<T> findByCondition(String whereCondition,
Map<String, Object> conditionParams,
Collection<String> embed,
Pageable pageable,
Class<T> entityClass... | [
"public",
"<",
"T",
">",
"Page",
"<",
"T",
">",
"findByCondition",
"(",
"String",
"whereCondition",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"conditionParams",
",",
"Collection",
"<",
"String",
">",
"embed",
",",
"Pageable",
"pageable",
",",
"Class",... | Find permitted entities by parameters with embed graph.
@param whereCondition the parameters condition
@param conditionParams the parameters map
@param embed the embed list
@param pageable the page info
@param entityClass the entity class to get
@param privilegeKey the privilege key for permission lookup
@param <T> the... | [
"Find",
"permitted",
"entities",
"by",
"parameters",
"with",
"embed",
"graph",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java#L132-L164 | train |
l0rdn1kk0n/wicket-jquery-selectors | src/main/java/de/agilecoders/wicket/jquery/CombinableConfig.java | CombinableConfig.combine | public CombinableConfig combine(Config... fallbackConfigs) {
CombinableConfig newConfig = this;
for (Config fallback : fallbackConfigs) {
newConfig = new ConfigWithFallback(newConfig, fallback);
}
return newConfig;
} | java | public CombinableConfig combine(Config... fallbackConfigs) {
CombinableConfig newConfig = this;
for (Config fallback : fallbackConfigs) {
newConfig = new ConfigWithFallback(newConfig, fallback);
}
return newConfig;
} | [
"public",
"CombinableConfig",
"combine",
"(",
"Config",
"...",
"fallbackConfigs",
")",
"{",
"CombinableConfig",
"newConfig",
"=",
"this",
";",
"for",
"(",
"Config",
"fallback",
":",
"fallbackConfigs",
")",
"{",
"newConfig",
"=",
"new",
"ConfigWithFallback",
"(",
... | combines this configuration with given ones. Given configuration doesn't override existing one.
@param fallbackConfigs the configurations to combine
@return this instance for chaining | [
"combines",
"this",
"configuration",
"with",
"given",
"ones",
".",
"Given",
"configuration",
"doesn",
"t",
"override",
"existing",
"one",
"."
] | a606263f7821d0b5f337c9e65f8caa466ad398ad | https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/CombinableConfig.java#L31-L37 | train |
xm-online/xm-commons | xm-commons-metric/src/main/java/com/icthh/xm/commons/metric/MetricsConfiguration.java | MetricsConfiguration.init | @PostConstruct
public void init() {
log.debug("Registering JVM gauges");
metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
metricRegistry.register(PROP_METRIC_REG_JVM_... | java | @PostConstruct
public void init() {
log.debug("Registering JVM gauges");
metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
metricRegistry.register(PROP_METRIC_REG_JVM_... | [
"@",
"PostConstruct",
"public",
"void",
"init",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Registering JVM gauges\"",
")",
";",
"metricRegistry",
".",
"register",
"(",
"PROP_METRIC_REG_JVM_MEMORY",
",",
"new",
"MemoryUsageGaugeSet",
"(",
")",
")",
";",
"metricR... | Init commons metrics | [
"Init",
"commons",
"metrics"
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-metric/src/main/java/com/icthh/xm/commons/metric/MetricsConfiguration.java#L68-L95 | train |
xm-online/xm-commons | xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/ConfigSignatureVerifierClient.java | ConfigSignatureVerifierClient.getSignatureVerifier | @Override
public SignatureVerifier getSignatureVerifier() throws Exception {
try {
HttpEntity<Void> request = new HttpEntity<>(new HttpHeaders());
String content = restTemplate.exchange(getPublicKeyEndpoint(),
HttpMethod.GET, request, String.class).getBody();
... | java | @Override
public SignatureVerifier getSignatureVerifier() throws Exception {
try {
HttpEntity<Void> request = new HttpEntity<>(new HttpHeaders());
String content = restTemplate.exchange(getPublicKeyEndpoint(),
HttpMethod.GET, request, String.class).getBody();
... | [
"@",
"Override",
"public",
"SignatureVerifier",
"getSignatureVerifier",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"HttpEntity",
"<",
"Void",
">",
"request",
"=",
"new",
"HttpEntity",
"<>",
"(",
"new",
"HttpHeaders",
"(",
")",
")",
";",
"String",
"con... | Fetches the public key from the MS Config.
@return the public key used to verify JWT tokens; or null. | [
"Fetches",
"the",
"public",
"key",
"from",
"the",
"MS",
"Config",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/ConfigSignatureVerifierClient.java#L44-L67 | train |
xm-online/xm-commons | xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/ConfigSignatureVerifierClient.java | ConfigSignatureVerifierClient.getPublicKeyEndpoint | private String getPublicKeyEndpoint() {
String tokenEndpointUrl = oauth2Properties.getSignatureVerification().getPublicKeyEndpointUri();
if (tokenEndpointUrl == null) {
throw new InvalidClientException("no token endpoint configured in application properties");
}
return tokenE... | java | private String getPublicKeyEndpoint() {
String tokenEndpointUrl = oauth2Properties.getSignatureVerification().getPublicKeyEndpointUri();
if (tokenEndpointUrl == null) {
throw new InvalidClientException("no token endpoint configured in application properties");
}
return tokenE... | [
"private",
"String",
"getPublicKeyEndpoint",
"(",
")",
"{",
"String",
"tokenEndpointUrl",
"=",
"oauth2Properties",
".",
"getSignatureVerification",
"(",
")",
".",
"getPublicKeyEndpointUri",
"(",
")",
";",
"if",
"(",
"tokenEndpointUrl",
"==",
"null",
")",
"{",
"thr... | Returns the configured endpoint URI to retrieve the public key. | [
"Returns",
"the",
"configured",
"endpoint",
"URI",
"to",
"retrieve",
"the",
"public",
"key",
"."
] | 43eb2273adb96f40830d7b905ee3a767b8715caf | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/ConfigSignatureVerifierClient.java#L72-L78 | train |
beangle/beangle3 | orm/hibernate/src/main/java/org/beangle/orm/hibernate/RailsNamingStrategy.java | RailsNamingStrategy.logicalCollectionTableName | public String logicalCollectionTableName(String tableName, String ownerEntityTable,
String associatedEntityTable, String propertyName) {
if (tableName == null) {
// use of a stringbuilder to workaround a JDK bug
return new StringBuilder(ownerEntityTable).append("_")
.append(associatedEnt... | java | public String logicalCollectionTableName(String tableName, String ownerEntityTable,
String associatedEntityTable, String propertyName) {
if (tableName == null) {
// use of a stringbuilder to workaround a JDK bug
return new StringBuilder(ownerEntityTable).append("_")
.append(associatedEnt... | [
"public",
"String",
"logicalCollectionTableName",
"(",
"String",
"tableName",
",",
"String",
"ownerEntityTable",
",",
"String",
"associatedEntityTable",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"tableName",
"==",
"null",
")",
"{",
"// use of a stringbuilder... | Returns either the table name if explicit or if there is an associated
table, the concatenation of owner entity table and associated table
otherwise the concatenation of owner entity table and the unqualified
property name | [
"Returns",
"either",
"the",
"table",
"name",
"if",
"explicit",
"or",
"if",
"there",
"is",
"an",
"associated",
"table",
"the",
"concatenation",
"of",
"owner",
"entity",
"table",
"and",
"associated",
"table",
"otherwise",
"the",
"concatenation",
"of",
"owner",
"... | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/RailsNamingStrategy.java#L151-L160 | train |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java | ActionSupport.addMessage | protected final void addMessage(String msgKey, Object... args) {
getFlash().addMessageNow(getTextInternal(msgKey, args));
} | java | protected final void addMessage(String msgKey, Object... args) {
getFlash().addMessageNow(getTextInternal(msgKey, args));
} | [
"protected",
"final",
"void",
"addMessage",
"(",
"String",
"msgKey",
",",
"Object",
"...",
"args",
")",
"{",
"getFlash",
"(",
")",
".",
"addMessageNow",
"(",
"getTextInternal",
"(",
"msgKey",
",",
"args",
")",
")",
";",
"}"
] | Add action message.
@param msgKey
@param args | [
"Add",
"action",
"message",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java#L213-L215 | train |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java | ActionSupport.addError | protected final void addError(String msgKey, Object... args) {
getFlash().addErrorNow(getTextInternal(msgKey, args));
} | java | protected final void addError(String msgKey, Object... args) {
getFlash().addErrorNow(getTextInternal(msgKey, args));
} | [
"protected",
"final",
"void",
"addError",
"(",
"String",
"msgKey",
",",
"Object",
"...",
"args",
")",
"{",
"getFlash",
"(",
")",
".",
"addErrorNow",
"(",
"getTextInternal",
"(",
"msgKey",
",",
"args",
")",
")",
";",
"}"
] | Add action error.
@param msgKey
@param args | [
"Add",
"action",
"error",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java#L223-L225 | train |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java | ActionSupport.addFlashError | protected final void addFlashError(String msgKey, Object... args) {
getFlash().addError(getTextInternal(msgKey, args));
} | java | protected final void addFlashError(String msgKey, Object... args) {
getFlash().addError(getTextInternal(msgKey, args));
} | [
"protected",
"final",
"void",
"addFlashError",
"(",
"String",
"msgKey",
",",
"Object",
"...",
"args",
")",
"{",
"getFlash",
"(",
")",
".",
"addError",
"(",
"getTextInternal",
"(",
"msgKey",
",",
"args",
")",
")",
";",
"}"
] | Add error to next action.
@param msgKey
@param args | [
"Add",
"error",
"to",
"next",
"action",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java#L233-L235 | train |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java | ActionSupport.addFlashMessage | protected final void addFlashMessage(String msgKey, Object... args) {
getFlash().addMessage(getTextInternal(msgKey, args));
} | java | protected final void addFlashMessage(String msgKey, Object... args) {
getFlash().addMessage(getTextInternal(msgKey, args));
} | [
"protected",
"final",
"void",
"addFlashMessage",
"(",
"String",
"msgKey",
",",
"Object",
"...",
"args",
")",
"{",
"getFlash",
"(",
")",
".",
"addMessage",
"(",
"getTextInternal",
"(",
"msgKey",
",",
"args",
")",
")",
";",
"}"
] | Add message to next action.
@param msgKey
@param args | [
"Add",
"message",
"to",
"next",
"action",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/action/ActionSupport.java#L243-L245 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java | CreateTraversingVisitorClass.addGetterAndSetter | private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) {
String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1);
traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field);
JMethod setVisitor = trave... | java | private void addGetterAndSetter(JDefinedClass traversingVisitor, JFieldVar field) {
String propName = Character.toUpperCase(field.name().charAt(0)) + field.name().substring(1);
traversingVisitor.method(JMod.PUBLIC, field.type(), "get" + propName).body()._return(field);
JMethod setVisitor = trave... | [
"private",
"void",
"addGetterAndSetter",
"(",
"JDefinedClass",
"traversingVisitor",
",",
"JFieldVar",
"field",
")",
"{",
"String",
"propName",
"=",
"Character",
".",
"toUpperCase",
"(",
"field",
".",
"name",
"(",
")",
".",
"charAt",
"(",
"0",
")",
")",
"+",
... | Convenience method to add a getter and setter method for the given field.
@param traversingVisitor
@param field | [
"Convenience",
"method",
"to",
"add",
"a",
"getter",
"and",
"setter",
"method",
"for",
"the",
"given",
"field",
"."
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/CreateTraversingVisitorClass.java#L151-L157 | train |
beangle/beangle3 | commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java | UrlBuilder.buildServletPath | private String buildServletPath() {
String uri = servletPath;
if (uri == null && null != requestURI) {
uri = requestURI;
if (!contextPath.equals("/")) uri = uri.substring(contextPath.length());
}
return (null == uri) ? "" : uri;
} | java | private String buildServletPath() {
String uri = servletPath;
if (uri == null && null != requestURI) {
uri = requestURI;
if (!contextPath.equals("/")) uri = uri.substring(contextPath.length());
}
return (null == uri) ? "" : uri;
} | [
"private",
"String",
"buildServletPath",
"(",
")",
"{",
"String",
"uri",
"=",
"servletPath",
";",
"if",
"(",
"uri",
"==",
"null",
"&&",
"null",
"!=",
"requestURI",
")",
"{",
"uri",
"=",
"requestURI",
";",
"if",
"(",
"!",
"contextPath",
".",
"equals",
"... | Returns servetPath without contextPath | [
"Returns",
"servetPath",
"without",
"contextPath"
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java#L53-L60 | train |
beangle/beangle3 | commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java | UrlBuilder.buildRequestUrl | public String buildRequestUrl() {
StringBuilder sb = new StringBuilder();
sb.append(buildServletPath());
if (null != pathInfo) {
sb.append(pathInfo);
}
if (null != queryString) {
sb.append('?').append(queryString);
}
return sb.toString();
} | java | public String buildRequestUrl() {
StringBuilder sb = new StringBuilder();
sb.append(buildServletPath());
if (null != pathInfo) {
sb.append(pathInfo);
}
if (null != queryString) {
sb.append('?').append(queryString);
}
return sb.toString();
} | [
"public",
"String",
"buildRequestUrl",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"buildServletPath",
"(",
")",
")",
";",
"if",
"(",
"null",
"!=",
"pathInfo",
")",
"{",
"sb",
".",
"append... | Returns request Url contain pathinfo and queryString but without contextPath. | [
"Returns",
"request",
"Url",
"contain",
"pathinfo",
"and",
"queryString",
"but",
"without",
"contextPath",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java#L65-L75 | train |
beangle/beangle3 | commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java | UrlBuilder.buildUrl | public String buildUrl() {
StringBuilder sb = new StringBuilder();
boolean includePort = true;
if (null != scheme) {
sb.append(scheme).append("://");
includePort = (port != (scheme.equals("http") ? 80 : 443));
}
if (null != serverName) {
sb.append(serverName);
if (includePort... | java | public String buildUrl() {
StringBuilder sb = new StringBuilder();
boolean includePort = true;
if (null != scheme) {
sb.append(scheme).append("://");
includePort = (port != (scheme.equals("http") ? 80 : 443));
}
if (null != serverName) {
sb.append(serverName);
if (includePort... | [
"public",
"String",
"buildUrl",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"includePort",
"=",
"true",
";",
"if",
"(",
"null",
"!=",
"scheme",
")",
"{",
"sb",
".",
"append",
"(",
"scheme",
")",
".",
"... | Returns full url | [
"Returns",
"full",
"url"
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/web/src/main/java/org/beangle/commons/web/url/UrlBuilder.java#L80-L98 | train |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.getEntry | public Map.Entry<K, V> getEntry(Object key) {
EntryImpl<K, V> entry = _entries[keyHash(key) & _mask];
while (entry != null) {
if (key.equals(entry._key)) { return entry; }
entry = entry._next;
}
return null;
} | java | public Map.Entry<K, V> getEntry(Object key) {
EntryImpl<K, V> entry = _entries[keyHash(key) & _mask];
while (entry != null) {
if (key.equals(entry._key)) { return entry; }
entry = entry._next;
}
return null;
} | [
"public",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"getEntry",
"(",
"Object",
"key",
")",
"{",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"_entries",
"[",
"keyHash",
"(",
"key",
")",
"&",
"_mask",
"]",
";",
"while",
"(",
"entry",
... | Returns the entry with the specified key.
@param key the key whose associated entry is to be returned.
@return the entry for the specified key or <code>null</code> if none. | [
"Returns",
"the",
"entry",
"with",
"the",
"specified",
"key",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L199-L206 | train |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.addEntry | private void addEntry(K key, V value) {
EntryImpl<K, V> entry = _poolFirst;
if (entry != null) {
_poolFirst = entry._after;
entry._after = null;
} else { // Pool empty.
entry = new EntryImpl<K, V>();
}
// Setup entry paramters.
entry._key = key;
entry._value = value;
i... | java | private void addEntry(K key, V value) {
EntryImpl<K, V> entry = _poolFirst;
if (entry != null) {
_poolFirst = entry._after;
entry._after = null;
} else { // Pool empty.
entry = new EntryImpl<K, V>();
}
// Setup entry paramters.
entry._key = key;
entry._value = value;
i... | [
"private",
"void",
"addEntry",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"_poolFirst",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"_poolFirst",
"=",
"entry",
".",
"_after",
";",
"entry",... | Adds a new entry for the specified key and value.
@param key the entry's key.
@param value the entry's value. | [
"Adds",
"a",
"new",
"entry",
"for",
"the",
"specified",
"key",
"and",
"value",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L648-L683 | train |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.removeEntry | private void removeEntry(EntryImpl<K, V> entry) {
// Removes from bucket.
EntryImpl<K, V> previous = entry._previous;
EntryImpl<K, V> next = entry._next;
if (previous != null) {
previous._next = next;
entry._previous = null;
} else { // First in bucket.
_entries[entry._index] = ne... | java | private void removeEntry(EntryImpl<K, V> entry) {
// Removes from bucket.
EntryImpl<K, V> previous = entry._previous;
EntryImpl<K, V> next = entry._next;
if (previous != null) {
previous._next = next;
entry._previous = null;
} else { // First in bucket.
_entries[entry._index] = ne... | [
"private",
"void",
"removeEntry",
"(",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"entry",
")",
"{",
"// Removes from bucket.",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"previous",
"=",
"entry",
".",
"_previous",
";",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"nex... | Removes the specified entry from the map.
@param entry the entry to be removed. | [
"Removes",
"the",
"specified",
"entry",
"from",
"the",
"map",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L690-L732 | train |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.readObject | @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
int capacity = stream.readInt();
initialize(capacity);
int size = stream.readInt();
for (int i = 0; i < size; i++) {
addEntry((K) stream.readObject(), (V) stream.readObje... | java | @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
int capacity = stream.readInt();
initialize(capacity);
int size = stream.readInt();
for (int i = 0; i < size; i++) {
addEntry((K) stream.readObject(), (V) stream.readObje... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"capacity",
"=",
"stream",
".",
"readInt",
"(",
")",
";",
"initialize"... | Requires special handling during de-serialization process.
@param stream the object input stream.
@throws IOException if an I/O error occurs.
@throws ClassNotFoundException if the class for the object de-serialized
is not found. | [
"Requires",
"special",
"handling",
"during",
"de",
"-",
"serialization",
"process",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L777-L785 | train |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.writeObject | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.writeInt(_capacity);
stream.writeInt(_size);
int count = 0;
EntryImpl<K, V> entry = _mapFirst;
while (entry != null) {
stream.writeObject(entry._key);
stream.writeObject(entry._value);
count++;
en... | java | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.writeInt(_capacity);
stream.writeInt(_size);
int count = 0;
EntryImpl<K, V> entry = _mapFirst;
while (entry != null) {
stream.writeObject(entry._key);
stream.writeObject(entry._value);
count++;
en... | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"stream",
")",
"throws",
"IOException",
"{",
"stream",
".",
"writeInt",
"(",
"_capacity",
")",
";",
"stream",
".",
"writeInt",
"(",
"_size",
")",
";",
"int",
"count",
"=",
"0",
";",
"EntryImpl",
... | Requires special handling during serialization process.
@param stream the object output stream.
@throws IOException if an I/O error occurs. | [
"Requires",
"special",
"handling",
"during",
"serialization",
"process",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L793-L805 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.discoverDirectClasses | static Set<JClass> discoverDirectClasses(Outline outline, Set<ClassOutline> classes) throws IllegalAccessException {
Set<String> directClassNames = new LinkedHashSet<>();
for(ClassOutline classOutline : classes) {
// for each field, if it's a bean, then visit it
List<FieldOutlin... | java | static Set<JClass> discoverDirectClasses(Outline outline, Set<ClassOutline> classes) throws IllegalAccessException {
Set<String> directClassNames = new LinkedHashSet<>();
for(ClassOutline classOutline : classes) {
// for each field, if it's a bean, then visit it
List<FieldOutlin... | [
"static",
"Set",
"<",
"JClass",
">",
"discoverDirectClasses",
"(",
"Outline",
"outline",
",",
"Set",
"<",
"ClassOutline",
">",
"classes",
")",
"throws",
"IllegalAccessException",
"{",
"Set",
"<",
"String",
">",
"directClassNames",
"=",
"new",
"LinkedHashSet",
"<... | Finds all external class references
@param outline root of the generated code
@param classes set of generated classes
@return set of external classes
@throws IllegalAccessException throw if there's an error introspecting the annotations | [
"Finds",
"all",
"external",
"class",
"references"
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L43-L71 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.parseXmlAnnotations | private static void parseXmlAnnotations(Outline outline, FieldOutline field, Set<String> directClasses) throws IllegalAccessException {
if (field instanceof UntypedListField) {
JFieldVar jfv = (JFieldVar) FieldHack.listField.get(field);
for(JAnnotationUse jau : jfv.annotations()) {
... | java | private static void parseXmlAnnotations(Outline outline, FieldOutline field, Set<String> directClasses) throws IllegalAccessException {
if (field instanceof UntypedListField) {
JFieldVar jfv = (JFieldVar) FieldHack.listField.get(field);
for(JAnnotationUse jau : jfv.annotations()) {
... | [
"private",
"static",
"void",
"parseXmlAnnotations",
"(",
"Outline",
"outline",
",",
"FieldOutline",
"field",
",",
"Set",
"<",
"String",
">",
"directClasses",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"field",
"instanceof",
"UntypedListField",
")",
"... | Parse the annotations on the field to see if there is an XmlElements
annotation on it. If so, we'll check this annotation to see if it
refers to any classes that are external from our code schema compile.
If we find any, then we'll add them to our visitor.
@param outline root of the generated code
@param field parses t... | [
"Parse",
"the",
"annotations",
"on",
"the",
"field",
"to",
"see",
"if",
"there",
"is",
"an",
"XmlElements",
"annotation",
"on",
"it",
".",
"If",
"so",
"we",
"ll",
"check",
"this",
"annotation",
"to",
"see",
"if",
"it",
"refers",
"to",
"any",
"classes",
... | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L83-L96 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.handleXmlElement | private static void handleXmlElement(Outline outline, Set<String> directClasses, JAnnotationValue type) {
StringWriter sw = new StringWriter();
JFormatter jf = new JFormatter(new PrintWriter(sw));
type.generate(jf);
String s = sw.toString();
s = s.substring(0, s.length()-".class"... | java | private static void handleXmlElement(Outline outline, Set<String> directClasses, JAnnotationValue type) {
StringWriter sw = new StringWriter();
JFormatter jf = new JFormatter(new PrintWriter(sw));
type.generate(jf);
String s = sw.toString();
s = s.substring(0, s.length()-".class"... | [
"private",
"static",
"void",
"handleXmlElement",
"(",
"Outline",
"outline",
",",
"Set",
"<",
"String",
">",
"directClasses",
",",
"JAnnotationValue",
"type",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JFormatter",
"jf",
"=",
... | Handles the extraction of the schema type from the XmlElement
annotation. This was surprisingly difficult. Apparently the
model doesn't provide access to the annotation we're referring to
so I need to print it and read the string back. Even the formatter
itself is final!
@param outline root of the generated code
@param... | [
"Handles",
"the",
"extraction",
"of",
"the",
"schema",
"type",
"from",
"the",
"XmlElement",
"annotation",
".",
"This",
"was",
"surprisingly",
"difficult",
".",
"Apparently",
"the",
"model",
"doesn",
"t",
"provide",
"access",
"to",
"the",
"annotation",
"we",
"r... | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L108-L117 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.getter | static JMethod getter(FieldOutline fieldOutline) {
final JDefinedClass theClass = fieldOutline.parent().implClass;
final String publicName = fieldOutline.getPropertyInfo().getName(true);
final JMethod getgetter = theClass.getMethod("get" + publicName, NONE);
if (getgetter != null) {
... | java | static JMethod getter(FieldOutline fieldOutline) {
final JDefinedClass theClass = fieldOutline.parent().implClass;
final String publicName = fieldOutline.getPropertyInfo().getName(true);
final JMethod getgetter = theClass.getMethod("get" + publicName, NONE);
if (getgetter != null) {
... | [
"static",
"JMethod",
"getter",
"(",
"FieldOutline",
"fieldOutline",
")",
"{",
"final",
"JDefinedClass",
"theClass",
"=",
"fieldOutline",
".",
"parent",
"(",
")",
".",
"implClass",
";",
"final",
"String",
"publicName",
"=",
"fieldOutline",
".",
"getPropertyInfo",
... | Borrowed this code from jaxb-commons project
@param fieldOutline reference to a field
@return Getter for the given field or null | [
"Borrowed",
"this",
"code",
"from",
"jaxb",
"-",
"commons",
"project"
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L152-L167 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.isJAXBElement | static boolean isJAXBElement(JType type) {
//noinspection RedundantIfStatement
if (type.fullName().startsWith(JAXBElement.class.getName())) {
return true;
}
return false;
} | java | static boolean isJAXBElement(JType type) {
//noinspection RedundantIfStatement
if (type.fullName().startsWith(JAXBElement.class.getName())) {
return true;
}
return false;
} | [
"static",
"boolean",
"isJAXBElement",
"(",
"JType",
"type",
")",
"{",
"//noinspection RedundantIfStatement",
"if",
"(",
"type",
".",
"fullName",
"(",
")",
".",
"startsWith",
"(",
"JAXBElement",
".",
"class",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",... | Returns true if the type is a JAXBElement. In the case of JAXBElements, we want to traverse its
underlying value as opposed to the JAXBElement.
@param type element type to test to see if its a JAXBElement
@return true if the type is a JAXBElement | [
"Returns",
"true",
"if",
"the",
"type",
"is",
"a",
"JAXBElement",
".",
"In",
"the",
"case",
"of",
"JAXBElements",
"we",
"want",
"to",
"traverse",
"its",
"underlying",
"value",
"as",
"opposed",
"to",
"the",
"JAXBElement",
"."
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L175-L181 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.allConcreteClasses | static List<JClass> allConcreteClasses(Set<ClassOutline> classes) {
return allConcreteClasses(classes, Collections.emptySet());
} | java | static List<JClass> allConcreteClasses(Set<ClassOutline> classes) {
return allConcreteClasses(classes, Collections.emptySet());
} | [
"static",
"List",
"<",
"JClass",
">",
"allConcreteClasses",
"(",
"Set",
"<",
"ClassOutline",
">",
"classes",
")",
"{",
"return",
"allConcreteClasses",
"(",
"classes",
",",
"Collections",
".",
"emptySet",
"(",
")",
")",
";",
"}"
] | Returns all of the concrete classes in the system
@param classes collection of classes to examine
@return List of concrete classes | [
"Returns",
"all",
"of",
"the",
"concrete",
"classes",
"in",
"the",
"system"
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L188-L190 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/ClassDiscoverer.java | ClassDiscoverer.allConcreteClasses | static List<JClass> allConcreteClasses(Set<ClassOutline> classes, Set<JClass> directClasses) {
List<JClass> results = new ArrayList<>();
classes.stream()
.filter(classOutline -> !classOutline.target.isAbstract())
.forEach(classOutline -> {
JClass implClass = c... | java | static List<JClass> allConcreteClasses(Set<ClassOutline> classes, Set<JClass> directClasses) {
List<JClass> results = new ArrayList<>();
classes.stream()
.filter(classOutline -> !classOutline.target.isAbstract())
.forEach(classOutline -> {
JClass implClass = c... | [
"static",
"List",
"<",
"JClass",
">",
"allConcreteClasses",
"(",
"Set",
"<",
"ClassOutline",
">",
"classes",
",",
"Set",
"<",
"JClass",
">",
"directClasses",
")",
"{",
"List",
"<",
"JClass",
">",
"results",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
... | Returns all of the concrete classes plus the direct classes passed in
@param classes collection of clases to test to see if they're abstract or concrete
@param directClasses set of classes to append to the list of concrete classes
@return list of concrete classes | [
"Returns",
"all",
"of",
"the",
"concrete",
"classes",
"plus",
"the",
"direct",
"classes",
"passed",
"in"
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/ClassDiscoverer.java#L198-L209 | train |
massfords/jaxb-visitor | src/main/java/com/massfords/jaxb/VisitorPlugin.java | VisitorPlugin.sortClasses | private Set<ClassOutline> sortClasses(Outline outline) {
Set<ClassOutline> sorted = new TreeSet<>((aOne, aTwo) -> {
String one = aOne.implClass.fullName();
String two = aTwo.implClass.fullName();
return one.compareTo(two);
});
sorted.addAll(outline.getClasses(... | java | private Set<ClassOutline> sortClasses(Outline outline) {
Set<ClassOutline> sorted = new TreeSet<>((aOne, aTwo) -> {
String one = aOne.implClass.fullName();
String two = aTwo.implClass.fullName();
return one.compareTo(two);
});
sorted.addAll(outline.getClasses(... | [
"private",
"Set",
"<",
"ClassOutline",
">",
"sortClasses",
"(",
"Outline",
"outline",
")",
"{",
"Set",
"<",
"ClassOutline",
">",
"sorted",
"=",
"new",
"TreeSet",
"<>",
"(",
"(",
"aOne",
",",
"aTwo",
")",
"->",
"{",
"String",
"one",
"=",
"aOne",
".",
... | The classes are sorted for test purposes only. This gives us a predictable order for our
assertions on the generated code.
@param outline | [
"The",
"classes",
"are",
"sorted",
"for",
"test",
"purposes",
"only",
".",
"This",
"gives",
"us",
"a",
"predictable",
"order",
"for",
"our",
"assertions",
"on",
"the",
"generated",
"code",
"."
] | 0d66cd4d8b6700b5eb67c028a87b53792be895b8 | https://github.com/massfords/jaxb-visitor/blob/0d66cd4d8b6700b5eb67c028a87b53792be895b8/src/main/java/com/massfords/jaxb/VisitorPlugin.java#L191-L199 | train |
beangle/beangle3 | orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java | HbmGenerator.findAnnotation | private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) {
Class<?> curr = cls;
T ann = null;
while (ann == null && curr != null && !curr.equals(Object.class)) {
ann = findAnnotationLocal(curr, annotationClass, name);
curr = curr.getSuperclass();
}... | java | private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) {
Class<?> curr = cls;
T ann = null;
while (ann == null && curr != null && !curr.equals(Object.class)) {
ann = findAnnotationLocal(curr, annotationClass, name);
curr = curr.getSuperclass();
}... | [
"private",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"findAnnotation",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"T",
">",
"annotationClass",
",",
"String",
"name",
")",
"{",
"Class",
"<",
"?",
">",
"curr",
"=",
"cls",
";",
"T",
"an... | find annotation on specified member
@param cls
@param annotationClass
@param name
@return | [
"find",
"annotation",
"on",
"specified",
"member"
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java#L106-L114 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.