Skip to content

Suggestion: Add custom toString() to domain objects. #6

Description

@aquaplanet

This code:

String value = client.listContainers().stream()
            .map(c -> c.getId() + " --- " + c.getState() + " --- " + c.getPorts() + " --- " + c.getCommand())
            .reduce("", (r, s) -> r + System.lineSeparator() + s);
System.out.println(value);

Gives output:

 b715c8e84e504464153a2da776fcef68b1be15fe4b38c05b16f3aa23fbacf2de --- running --- [com.github.khazrak.jdocker.model.api124.ContainerPort@4180bdf1, com.github.khazrak.jdocker.model.api124.ContainerPort@762edb01, com.github.khazrak.jdocker.model.api124.ContainerPort@309d3365, com.github.khazrak.jdocker.model.api124.ContainerPort@4834ad04, com.github.khazrak.jdocker.model.api124.ContainerPort@c9ffec6, com.github.khazrak.jdocker.model.api124.ContainerPort@ce9ca87] --- /app/run.sh

It would be useful if some of the domain objects contained a custom toString(). Saw some objects under model has many properties and those might need only to present a few properties. but the ContainerPort could present it like docker ps "0.0.0.0:1883->1883/tcp".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions