// Path: src/main/java/net/davidtanzer/jobjectformatter/ObjectFormatter.java
// public class ObjectFormatter {
// 	private static AtomicReference<FormattedStringGenerator> generator = new AtomicReference<>(new FormattedStringGenerator());
// 
// 	/**
// 	 * Configure the {@link net.davidtanzer.jobjectformatter.FormattedStringGenerator} to use when formatting objects.
// 	 *
// 	 * @param generator The globally configured generator.
// 	 */
// 	public static void configureGenerator(final FormattedStringGenerator generator) {
// 		ObjectFormatter.generator.set(generator);
// 	}
// 
// 	/**
// 	 * Format an object with the globally configured {@link net.davidtanzer.jobjectformatter.FormattedStringGenerator}.
// 	 *
// 	 * @param object The object to format.
// 	 * @return The string representation of the object.
// 	 */
// 	public static String format(final Object object) {
// 		return generator.get().format(object);
// 	}
// }


import net.davidtanzer.jobjectformatter.ObjectFormatter;
import net.davidtanzer.jobjectformatter.annotations.*;
/*
   Copyright 2015 David Tanzer (business@davidtanzer.net / @dtanzer)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package net.davidtanzer.jobjectformatter.examples.annotated;


public class AnnotationsExample {
	public static void main(String[] args) {
		Address address = new Address("Evergreen Terrace", "12b");
		Person person = new Person("Jane", "Doe", address);
		address.setOwner(person);

		System.out.println("Person: " + person);
		System.out.println("Address: " + address);

		System.out.println("Person (only annotated fields): " + new PersonAnnotatedFields("Jane", "Doe", address));
		System.out.println("Person (no): " + new PersonNoFields("Jane", "Doe", address));
	}

	private static class Person {
		private String firstName;
		@FormattedField(transitive = FormattedFieldType.DEFAULT)
		private String lastName;
		private Address address;

		public Person(final String firstName, final String lastName, final Address address) {
			this.firstName = firstName;
			this.lastName = lastName;
			this.address = address;
		}

		@Override
		@Formatted(value = FormattedInclude.ALL_FIELDS, transitive = TransitiveInclude.NO_FIELDS)
		public String toString() {
// Path: src/main/java/net/davidtanzer/jobjectformatter/ObjectFormatter.java
// public class ObjectFormatter {
// 	private static AtomicReference<FormattedStringGenerator> generator = new AtomicReference<>(new FormattedStringGenerator());
// 
// 	/**
// 	 * Configure the {@link net.davidtanzer.jobjectformatter.FormattedStringGenerator} to use when formatting objects.
// 	 *
// 	 * @param generator The globally configured generator.
// 	 */
// 	public static void configureGenerator(final FormattedStringGenerator generator) {
// 		ObjectFormatter.generator.set(generator);
// 	}
// 
// 	/**
// 	 * Format an object with the globally configured {@link net.davidtanzer.jobjectformatter.FormattedStringGenerator}.
// 	 *
// 	 * @param object The object to format.
// 	 * @return The string representation of the object.
// 	 */
// 	public static String format(final Object object) {
// 		return generator.get().format(object);
// 	}
// }


// Path: src/main/java/net/davidtanzer/jobjectformatter/examples/annotated/AnnotationsExample.java
import net.davidtanzer.jobjectformatter.ObjectFormatter;
import net.davidtanzer.jobjectformatter.annotations.*;

/*
   Copyright 2015 David Tanzer (business@davidtanzer.net / @dtanzer)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package net.davidtanzer.jobjectformatter.examples.annotated;


public class AnnotationsExample {
	public static void main(String[] args) {
		Address address = new Address("Evergreen Terrace", "12b");
		Person person = new Person("Jane", "Doe", address);
		address.setOwner(person);

		System.out.println("Person: " + person);
		System.out.println("Address: " + address);

		System.out.println("Person (only annotated fields): " + new PersonAnnotatedFields("Jane", "Doe", address));
		System.out.println("Person (no): " + new PersonNoFields("Jane", "Doe", address));
	}

	private static class Person {
		private String firstName;
		@FormattedField(transitive = FormattedFieldType.DEFAULT)
		private String lastName;
		private Address address;

		public Person(final String firstName, final String lastName, final Address address) {
			this.firstName = firstName;
			this.lastName = lastName;
			this.address = address;
		}

		@Override
		@Formatted(value = FormattedInclude.ALL_FIELDS, transitive = TransitiveInclude.NO_FIELDS)
		public String toString() {
			return ObjectFormatter.format(this);