Due to a ransomware attack, the wiki was reverted to a July 2022 version. . We apologize for the lack of a more recent valid backup.
...
| Code Block | ||
|---|---|---|
| ||
module Test {
namespace "http://test.example.com/";
prefix "test";
organization "ACME Inc.";
grouping endpoint {
leaf address {
type int32;
}
leaf port {
type int8;
}
}
container connection {
container source {
uses endpoint;
}
container destination {
uses endpoint;
}
}
.
.
.
} |
| Code Block | ||
|---|---|---|
| ||
public interface Endpoint {
.
.
.
interface EndpointBuilder {
.
.
.
}
}
public class EndpointBuilder implements Endpoint.EndpointBuilder {
.
.
.
public final class EndpointImpl implements Endpoint {
.
.
.
}
}
public interface Source extends AugmentationHolder {
.
.
.
Endpoint endpoint();
interface SourceBuilder {
.
.
.
Endpoint endpoint();
SourceBuilder endpoint(Endpoint endpoint);
}
}
public class SourceBuilder implements Source.SourceBuilder {
private Endpoint endpoint;
@Override
public Endpoint endpoint() {
return endpoint;
}
@Override
public SourceBuilder endpoint(Endpoint endpoint) {
this.endpoint = endpoint;
return this;
}
.
.
.
public final class SourceImpl implements Source {
private Endpoint endpoint;
@Override
public Endpoint endpoint() {
return endpoint;
}
.
.
.
}
}
public interface Destination extends AugmentationHolder {
.
.
.
Endpoint endpoint();
interface DestinationBuilder {
.
.
.
Endpoint endpoint();
DestinationBuilder endpoint(Endpoint endpoint);
}
}
public class DestinationBuilder implements Destination.DestinationBuilder {
private Endpoint endpoint;
@Override
public Endpoint endpoint() {
return endpoint;
}
@Override
public DestinationBuilder endpoint(Endpoint endpoint) {
this.endpoint = endpoint;
return this;
}
.
.
.
public final class DestinationImpl implements Destination {
private Endpoint endpoint;
@Override
public Endpoint endpoint() {
return endpoint;
}
.
.
.
}
} |
Choice and case
Overview
The choice statement defines a set of alternatives, only one of which may exist at any one time. The argument is an identifier, followed by a block of sub-statements that holds detailed choice information.
...