This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atomic type arrays are now handled via an context provider. This approach currently has a drawback. Atomic type arrays will be outputted like this: 17:04:30.642 [main] ERROR i.t.c.connector.LogConnector - { "<TYPE>":"char[]", "value":"String<'['A', 'B', 'C', 'A', 'D', 'A', 'D', 'A', 'D', 'D', 'A', 'D', 'A', 'D', 'A', 'D', 'A', 'D', 'D', 'A', 'D', 'A', 'D', 'A']'>" } So we still need to add some kind of AtomicTraceeContextProvider which returns exactly one value.
- Loading branch information
1 parent
993328e
commit 742f6d7
Showing
20 changed files
with
1,074 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
.../tracee/contextlogger/contextprovider/core/java/arrays/ArrayContextProviderConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
|
||
public final class ArrayContextProviderConstants { | ||
|
||
private ArrayContextProviderConstants() { | ||
|
||
} | ||
|
||
protected final static String ELEMENT_SEPARATOR = ", "; | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...io/tracee/contextlogger/contextprovider/core/java/arrays/BooleanArrayContextProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
import io.tracee.contextlogger.contextprovider.api.ProfileConfig; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProvider; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProviderMethod; | ||
import io.tracee.contextlogger.contextprovider.api.WrappedContextData; | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProvider(displayName = "boolean[]") | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public class BooleanArrayContextProvider implements WrappedContextData<boolean[]> { | ||
private boolean[] array; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
public BooleanArrayContextProvider() { | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public BooleanArrayContextProvider(final boolean[] booleanArray) { | ||
this.array = booleanArray; | ||
} | ||
|
||
@Override | ||
public void setContextData(Object instance) throws ClassCastException { | ||
this.array = (boolean[]) instance; | ||
} | ||
|
||
@Override | ||
public boolean[] getContextData() { | ||
return this.array; | ||
} | ||
|
||
public Class<boolean[]> getWrappedType() { | ||
return boolean[].class; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProviderMethod(displayName = "value", order = 10) | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public String getArrayStringRepresentation() { | ||
|
||
if (array != null) { | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("["); | ||
|
||
boolean first = true; | ||
|
||
for (boolean element : array) { | ||
if (first) { | ||
first = false; | ||
} else { | ||
sb.append(ArrayContextProviderConstants.ELEMENT_SEPARATOR); | ||
} | ||
sb.append(element); | ||
} | ||
|
||
sb.append("]"); | ||
|
||
return sb.toString(); | ||
} else { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...va/io/tracee/contextlogger/contextprovider/core/java/arrays/ByteArrayContextProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
import io.tracee.contextlogger.contextprovider.api.ProfileConfig; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProvider; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProviderMethod; | ||
import io.tracee.contextlogger.contextprovider.api.WrappedContextData; | ||
|
||
import java.util.Base64; | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProvider(displayName = "byte[]") | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public class ByteArrayContextProvider implements WrappedContextData<byte[]> { | ||
private byte[] array; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
public ByteArrayContextProvider() { | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public ByteArrayContextProvider(final byte[] array) { | ||
this.array = array; | ||
} | ||
|
||
@Override | ||
public void setContextData(Object instance) throws ClassCastException { | ||
this.array = (byte[]) instance; | ||
} | ||
|
||
@Override | ||
public byte[] getContextData() { | ||
return this.array; | ||
} | ||
|
||
public Class<byte[]> getWrappedType() { | ||
return byte[].class; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProviderMethod(displayName = "value", order = 10) | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public String getArrayStringRepresentation() { | ||
|
||
if (array != null) { | ||
return Base64.getEncoder().encodeToString(array); | ||
} else { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...va/io/tracee/contextlogger/contextprovider/core/java/arrays/CharArrayContextProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
import io.tracee.contextlogger.contextprovider.api.ProfileConfig; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProvider; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProviderMethod; | ||
import io.tracee.contextlogger.contextprovider.api.WrappedContextData; | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProvider(displayName = "char[]") | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public class CharArrayContextProvider implements WrappedContextData<char[]> { | ||
private char[] array; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
public CharArrayContextProvider() { | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public CharArrayContextProvider(final char[] array) { | ||
this.array = array; | ||
} | ||
|
||
@Override | ||
public void setContextData(Object instance) throws ClassCastException { | ||
this.array = (char[]) instance; | ||
} | ||
|
||
@Override | ||
public char[] getContextData() { | ||
return this.array; | ||
} | ||
|
||
public Class<char[]> getWrappedType() { | ||
return char[].class; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProviderMethod(displayName = "value", order = 10) | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public String getArrayStringRepresentation() { | ||
|
||
if (array != null) { | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("["); | ||
|
||
boolean first = true; | ||
|
||
for (char element : array) { | ||
if (first) { | ||
first = false; | ||
} else { | ||
sb.append(ArrayContextProviderConstants.ELEMENT_SEPARATOR); | ||
} | ||
sb.append("'").append(element).append("'"); | ||
} | ||
|
||
sb.append("]"); | ||
|
||
return sb.toString(); | ||
} else { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
70 changes: 70 additions & 0 deletions
70
.../io/tracee/contextlogger/contextprovider/core/java/arrays/DoubleArrayContextProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
import io.tracee.contextlogger.contextprovider.api.ProfileConfig; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProvider; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProviderMethod; | ||
import io.tracee.contextlogger.contextprovider.api.WrappedContextData; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProvider(displayName = "double[]") | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public class DoubleArrayContextProvider implements WrappedContextData<double[]> { | ||
private double[] array; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
public DoubleArrayContextProvider() { | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public DoubleArrayContextProvider(final double[] array) { | ||
this.array = array; | ||
} | ||
|
||
@Override | ||
public void setContextData(Object instance) throws ClassCastException { | ||
this.array = (double[]) instance; | ||
} | ||
|
||
@Override | ||
public double[] getContextData() { | ||
return this.array; | ||
} | ||
|
||
public Class<double[]> getWrappedType() { | ||
return double[].class; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProviderMethod(displayName = "value", order = 10) | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public String getArrayStringRepresentation() { | ||
|
||
if (array != null) { | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("["); | ||
|
||
boolean first = true; | ||
|
||
for (double element : array) { | ||
if (first) { | ||
first = false; | ||
} else { | ||
sb.append(ArrayContextProviderConstants.ELEMENT_SEPARATOR); | ||
} | ||
sb.append(element); | ||
} | ||
|
||
sb.append("]"); | ||
|
||
return sb.toString(); | ||
} else { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...a/io/tracee/contextlogger/contextprovider/core/java/arrays/FloatArrayContextProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.tracee.contextlogger.contextprovider.core.java.arrays; | ||
|
||
import io.tracee.contextlogger.contextprovider.api.ProfileConfig; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProvider; | ||
import io.tracee.contextlogger.contextprovider.api.TraceeContextProviderMethod; | ||
import io.tracee.contextlogger.contextprovider.api.WrappedContextData; | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProvider(displayName = "float[]") | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public class FloatArrayContextProvider implements WrappedContextData<float[]> { | ||
private float[] array; | ||
|
||
|
||
@SuppressWarnings("unused") | ||
public FloatArrayContextProvider() { | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public FloatArrayContextProvider(final float[] array) { | ||
this.array = array; | ||
} | ||
|
||
@Override | ||
public void setContextData(Object instance) throws ClassCastException { | ||
this.array = (float[]) instance; | ||
} | ||
|
||
@Override | ||
public float[] getContextData() { | ||
return this.array; | ||
} | ||
|
||
public Class<float[]> getWrappedType() { | ||
return float[].class; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
@TraceeContextProviderMethod(displayName = "value", order = 10) | ||
@ProfileConfig(basic = true, enhanced = true, full = true) | ||
public String getArrayStringRepresentation() { | ||
|
||
if (array != null) { | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
sb.append("["); | ||
|
||
boolean first = true; | ||
|
||
for (float element : array) { | ||
if (first) { | ||
first = false; | ||
} else { | ||
sb.append(ArrayContextProviderConstants.ELEMENT_SEPARATOR); | ||
} | ||
sb.append(element); | ||
} | ||
|
||
sb.append("]"); | ||
|
||
return sb.toString(); | ||
} else { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.