Package aQute.libg.reporter
Class ReporterAdapter
- java.lang.Object
-
- aQute.libg.reporter.ReporterAdapter
-
- Direct Known Subclasses:
Env
,LogToReporterAdapter
,ReplacerAdapter
,Slf4jReporter
public class ReporterAdapter extends java.lang.Object implements Reporter, Report, java.lang.Runnable
Mainly used for testing where reporters are needed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Report
Report.Location
-
Nested classes/interfaces inherited from interface aQute.service.reporter.Reporter
Reporter.SetLocation
-
-
Constructor Summary
Constructors Constructor Description ReporterAdapter()
ReporterAdapter(java.lang.Appendable app)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addErrors(java.lang.String prefix, java.util.Collection<java.lang.String> errors)
Add a number of errorsvoid
addWarnings(java.lang.String prefix, java.util.Collection<java.lang.String> warnings)
Add a number of warningsboolean
check(java.lang.String... pattern)
Reporter.SetLocation
error(java.lang.String s, java.lang.Object... args)
Create an error.Reporter.SetLocation
exception(java.lang.Throwable t, java.lang.String s, java.lang.Object... args)
Dedicated message for an exception.java.util.List<java.lang.String>
getErrors()
Return the errors.boolean
getInfo(Report other)
boolean
getInfo(Report other, java.lang.String prefix)
Report.Location
getLocation(java.lang.String msg)
Return the errors for the given error or warning.<T> T
getMessages(java.lang.Class<T> c)
Return a messages object bound to this adapterjava.util.Formatter
getOut()
java.util.List<java.lang.String>
getWarnings()
Return the warnings.boolean
isExceptions()
boolean
isOk()
Check if this report has any relevant errors that should make the run associated with this report invalid.boolean
isPedantic()
The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.boolean
isPerfect()
boolean
isTrace()
void
progress(float progress, java.lang.String s, java.lang.Object... args)
Deprecated.Use SLF4J Logger.info(aQute.libg.slf4j.GradleLogging.LIFECYCLE) instead.void
report(java.lang.Appendable out)
Report the errors and warningsvoid
run()
Handy routine that can be extended by subclasses so they can run inside the contextvoid
setExceptions(boolean exceptions)
void
setPedantic(boolean pedantic)
void
setTrace(boolean b)
void
trace(java.lang.String s, java.lang.Object... args)
Create a warning.Reporter.SetLocation
warning(java.lang.String s, java.lang.Object... args)
Create a warning.
-
-
-
Method Detail
-
isExceptions
public boolean isExceptions()
- Returns:
- the exceptions
-
setExceptions
public void setExceptions(boolean exceptions)
- Parameters:
exceptions
- the exceptions to set
-
getOut
public java.util.Formatter getOut()
- Returns:
- the out
-
isTrace
public boolean isTrace()
- Returns:
- the trace
-
setPedantic
public void setPedantic(boolean pedantic)
- Parameters:
pedantic
- the pedantic to set
-
error
public Reporter.SetLocation error(java.lang.String s, java.lang.Object... args)
Description copied from interface:Reporter
Create an error. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.
-
exception
public Reporter.SetLocation exception(java.lang.Throwable t, java.lang.String s, java.lang.Object... args)
Description copied from interface:Reporter
Dedicated message for an exception.
-
warning
public Reporter.SetLocation warning(java.lang.String s, java.lang.Object... args)
Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.
-
progress
@Deprecated public void progress(float progress, java.lang.String s, java.lang.Object... args)
Deprecated.Use SLF4J Logger.info(aQute.libg.slf4j.GradleLogging.LIFECYCLE) instead.Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.
-
trace
public void trace(java.lang.String s, java.lang.Object... args)
Description copied from interface:Reporter
Create a warning. Implementations must ensure that the given args are not prevented from garbage collecting. The args must have a proper toString method.
-
getWarnings
public java.util.List<java.lang.String> getWarnings()
Description copied from interface:Report
Return the warnings. This list must not be changed and may be immutable.- Specified by:
getWarnings
in interfaceReport
- Returns:
- the warnings
-
getErrors
public java.util.List<java.lang.String> getErrors()
Description copied from interface:Report
Return the errors. This list must not be changed and may be immutable.
-
isPedantic
public boolean isPedantic()
Description copied from interface:Reporter
The provider of the reporter wants pedantic reporting, meaning every possible warning should be reported.- Specified by:
isPedantic
in interfaceReporter
- Returns:
- if this is a pedantic reporter.
-
setTrace
public void setTrace(boolean b)
-
isOk
public boolean isOk()
Description copied from interface:Report
Check if this report has any relevant errors that should make the run associated with this report invalid. I.e. if this returns false then the run should be disregarded.
-
isPerfect
public boolean isPerfect()
-
check
public boolean check(java.lang.String... pattern)
-
report
public void report(java.lang.Appendable out)
Report the errors and warnings
-
getInfo
public boolean getInfo(Report other)
-
getInfo
public boolean getInfo(Report other, java.lang.String prefix)
-
getLocation
public Report.Location getLocation(java.lang.String msg)
Description copied from interface:Report
Return the errors for the given error or warning. Can return null.- Specified by:
getLocation
in interfaceReport
- Parameters:
msg
- The message- Returns:
- null or the location of the message
-
run
public void run()
Handy routine that can be extended by subclasses so they can run inside the context- Specified by:
run
in interfacejava.lang.Runnable
-
getMessages
public <T> T getMessages(java.lang.Class<T> c)
Return a messages object bound to this adapter
-
addErrors
public void addErrors(java.lang.String prefix, java.util.Collection<java.lang.String> errors)
Add a number of errors
-
addWarnings
public void addWarnings(java.lang.String prefix, java.util.Collection<java.lang.String> warnings)
Add a number of warnings
-
-