Skip to content

Commit

Permalink
📝 JavaDoc fixes;
Browse files Browse the repository at this point in the history
Also consistent indentation.
  • Loading branch information
gunnarmorling committed Dec 23, 2021
1 parent 1cf805d commit 082996f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 43 deletions.
38 changes: 20 additions & 18 deletions jfrunit-core/src/main/java/org/moditect/jfrunit/JfrEventType.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,37 @@
import jdk.jfr.consumer.RecordedStackTrace;

/**
* Base class for generated typed events when builder is used
* Base class for generated typed events when the the JFR Unit event type builder is used.
*
* <pre>
* JfrEventTypes.THREAD_SLEEP.withTime(Duration.ofMillis(50))
* </pre>
*
* Predicates (ex. withTime) are stored so that can be used during assertion verification
* @see org.moditect.jfrunit.JfrEventsAssert#contains(JfrEventType).
*
* matches methods conaains the actual assertion logic and are invoked by generated events types to build the JfrPredicate.
* Predicates (e.g. withTime) are stored so that they can be used during assertion verification.
*
* <code>matches</code> methods contain the actual assertion logic and are invoked by generated events types to build the <code>JfrPredicate</code>.
*
* <pre>
* public ThreadSleep withTime(java.time.Duration time) {
* getPredicates().add(
* new org.moditect.jfrunit.JfrPredicate(
* input ->
* <strong>matches</strong>(time, "time", input),
* "time",
* time.toString()
* )
* );
* public ThreadSleep withTime(java.time.Duration time) {
* getPredicates().add(
* new org.moditect.jfrunit.JfrPredicate(
* input -> matches(time, "time", input),
* "time",
* time.toString()
* )
* );
*
* return this;
* }
* return this;
* }
* </pre>
* @see org.moditect.jfrunit.events.ThreadSleep#withTime(Duration).
*
* @see org.moditect.jfrunit.JfrEventsAssert#contains(JfrEventType)
* @see org.moditect.jfrunit.events.ThreadSleep#withTime(Duration)
*/
public abstract class JfrEventType {

/**
* Event name, ex. jdk.ThreadSleep
* Event name, e.g. "jdk.ThreadSleep"
*/
private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import freemarker.template.TemplateExceptionHandler;

/**
* JFR types generator implementation, given json that represent standard jfr events
* generates classes and default methods that are used by jfrunit in order
* to build assertions
* JFR types generator; given a JSON file that represents the standard JFR events,
* it generates classes and default methods that can be used with JfrUnit in order
* to build assertions.
*/
public class JfrUnitConstantsGenerator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.moditect.jfrunit.JfrEventType;
*
*/
public class JfrEventTypes {
<#list events as event>
public static final ${package}.${event.name} ${event.typeUpperCase} = ${package}.${event.name}.INSTANCE;
</#list>
<#list events as event>
public static final ${package}.${event.name} ${event.typeUpperCase} = ${package}.${event.name}.INSTANCE;
</#list>
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ import java.util.Objects;
* ${event.description}
*/
public class ${event.name} extends JfrEventType {
public static final ${event.name} INSTANCE = new ${event.name}();
public static final String EVENT_NAME = "jdk.${event.name}";
<#list event.attributes as attribute>
public static final Attribute<${event.name}, ${attribute.objectType}> ${attribute.nameUpperCase} = new Attribute("${attribute.name}");
</#list>
public static final ${event.name} INSTANCE = new ${event.name}();
public static final String EVENT_NAME = "jdk.${event.name}";
<#list event.attributes as attribute>
public static final Attribute<${event.name}, ${attribute.objectType}> ${attribute.nameUpperCase} = new Attribute<>("${attribute.name}");
</#list>

public ${event.name}() {
super(EVENT_NAME);
}
public ${event.name}() {
super(EVENT_NAME);
}

<#list event.attributes as attribute>
<#list event.attributes as attribute>
public ${event.name} ${attribute.methodName}(${attribute.objectType} ${attribute.name}) {
getPredicates().add(
new org.moditect.jfrunit.JfrPredicate(
input ->
matches(${attribute.name}, "${attribute.name}", input),
getPredicates().add(
new org.moditect.jfrunit.JfrPredicate(
input ->
matches(${attribute.name}, "${attribute.name}", input),
"${attribute.name}",
${attribute.name}.toString()
)
);
)
);

return this;
return this;
}

</#list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package ${package}.model;
import java.lang.*;

public class ${type.name} {
<#list type.attributes as attribute>
public ${attribute.type} <#if attribute.name == "package">packageName<#else>${attribute.name}</#if>;
</#list>
<#list type.attributes as attribute>
public ${attribute.type} <#if attribute.name == "package">packageName<#else>${attribute.name}</#if>;
</#list>
}

0 comments on commit 082996f

Please sign in to comment.