Skip to content

Entry for the Java coding contest - #1

Open
lucianpalaghe wants to merge 1 commit into
mcserby-accesa:mainfrom
lucianpalaghe:main
Open

lucianpalaghe wants to merge 1 commit into
mcserby-accesa:mainfrom
lucianpalaghe:main

Conversation

@lucianpalaghe

Copy link
Copy Markdown

Recursively instantiates objects and their fields. Mitigates against cyclic references within a class and very deep object trees by having a with a maximum stack depth of 1000.

Implementation details:

  • ObjectMother class: loops through an object's fields, trying to get a random value for each by either:

    • getting one from a list of TypeInstantiators
    • instantiating an object of the given type by calling its default no args constructor
  • TypeInstantiator interface: implementations of this interface provide instances for types filled with random values

  • Instantiator class: implements interface required by coding challenge, serializes objects created by ObjectMother to either XML or JSON

Already existing(likely better) implementations that satisfy the requirement:

return Optional.empty();
}

stackDepth.get().incrementAndGet();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never gets decremented, oh well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant