java.lang.Object
java.lang.Record
com.agentforge4j.util.net.EgressCheckResult
- Record Components:
allowed- whether the target is an eligible egress destinationreason-nullwhenallowed()istrue; otherwise a non-secret description of the classification (host and address detail, never a request body, header, or secret)
Outcome of an
OutboundEgressGuard classification of a target URL. This is a neutral, dependency-free
classification result — it states whether the target resolves to an eligible (public) destination and, when
not, a non-secret reason() describing why. It carries no policy verb and never throws; the caller decides
how to react (fail a tool call, refuse a configuration, and so on).-
Constructor Summary
ConstructorsConstructorDescriptionEgressCheckResult(boolean allowed, String reason) Enforces the result invariants: an allowed result carries no (misleading) denial reason, and a denied result carries a non-blank reason. -
Method Summary
Modifier and TypeMethodDescriptionstatic EgressCheckResultallow()booleanallowed()Returns the value of theallowedrecord component.static EgressCheckResultfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.reason()Returns the value of thereasonrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EgressCheckResult
Enforces the result invariants: an allowed result carries no (misleading) denial reason, and a denied result carries a non-blank reason. The reason being non-secret is a caller contract — the guard only ever supplies host/scheme classification detail — and cannot be machine-checked here.- Throws:
IllegalArgumentException- ifallowedistruewith a non-null reason, orfalsewith a blank reason
-
-
Method Details
-
allow
- Returns:
- an allowed result with no reason
-
deny
- Parameters:
reason- non-blank, non-secret description of why the target is not eligible- Returns:
- a denied result carrying
reason
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
allowed
public boolean allowed()Returns the value of theallowedrecord component.- Returns:
- the value of the
allowedrecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-