Reads one kind of address of the configuration: a scheme or a shorthand
(github:, a company's cdn:). RemoteAddresses asks its resolvers in
order, and the first that supports a value resolves it: a chain of
responsibility, so a new kind of address is a new resolver, not a
change of the others.
// `cdn:themes/ocean.yml` is a file of the company's CDN.
final class CdnAddressResolver implements RemoteAddressResolver {
const CdnAddressResolver();
@override
bool supports(String text) => text.startsWith('cdn:');
@override
Uri resolve(String text, {required String property}) =>
Uri.https('cdn.example.com', '/${text.substring('cdn:'.length)}');
}
final app = SpringApplication(
[appBeans],
addressResolvers: [const CdnAddressResolver()],
);
Spring (Java): like a ProtocolResolver of the ResourceLoader.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolve(
String text, {required String property}) → Uri -
The address
textnames. Throws an ArgumentError namedpropertywhentextis malformed. -
supports(
String text) → bool -
Whether this resolver reads
text(by its scheme or prefix). -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited