// Path: src/com/esotericsoftware/yamlbeans/Beans.java
// static public abstract class Property implements Comparable<Property> {
// 	private final Class declaringClass;
// 	private final String name;
// 	private final Class type;
// 	private final Class elementType;
// 
// 	Property (Class declaringClass, String name, Class type, Type genericType) {
// 		this.declaringClass = declaringClass;
// 		this.name = name;
// 		this.type = type;
// 		this.elementType = getElementTypeFromGenerics(genericType);
// 	}
// 
// 	private Class getElementTypeFromGenerics (Type type) {
// 		if (type instanceof ParameterizedType) {
// 			ParameterizedType parameterizedType = (ParameterizedType)type;
// 			Type rawType = parameterizedType.getRawType();
// 
// 			if (isCollection(rawType) || isMap(rawType)) {
// 				Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
// 				if (actualTypeArguments.length > 0) {
// 					final Type cType = actualTypeArguments[actualTypeArguments.length - 1];
// 					if (cType instanceof Class) {
// 						return (Class)cType;
// 					} else if (cType instanceof WildcardType) {
// 						WildcardType t = (WildcardType)cType;
// 						final Type bound = t.getUpperBounds()[0];
// 						return bound instanceof Class ? (Class)bound : null;
// 					} else if (cType instanceof ParameterizedType) {
// 						ParameterizedType t = (ParameterizedType)cType;
// 						final Type rt = t.getRawType();
// 						return rt instanceof Class ? (Class)rt : null;
// 					}
// 				}
// 			}
// 		}
// 		return null;
// 	}
// 
// 	private boolean isMap (Type type) {
// 		return Map.class.isAssignableFrom((Class)type);
// 	}
// 
// 	private boolean isCollection (Type type) {
// 		return Collection.class.isAssignableFrom((Class)type);
// 	}
// 
// 	public int hashCode () {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
// 		result = prime * result + ((name == null) ? 0 : name.hashCode());
// 		result = prime * result + ((type == null) ? 0 : type.hashCode());
// 		result = prime * result + ((elementType == null) ? 0 : elementType.hashCode());
// 		return result;
// 	}
// 
// 	public boolean equals (Object obj) {
// 		if (this == obj) return true;
// 		if (obj == null) return false;
// 		if (getClass() != obj.getClass()) return false;
// 		Property other = (Property)obj;
// 		if (declaringClass == null) {
// 			if (other.declaringClass != null) return false;
// 		} else if (!declaringClass.equals(other.declaringClass)) return false;
// 		if (name == null) {
// 			if (other.name != null) return false;
// 		} else if (!name.equals(other.name)) return false;
// 		if (type == null) {
// 			if (other.type != null) return false;
// 		} else if (!type.equals(other.type)) return false;
// 		if (elementType == null) {
// 			if (other.elementType != null) return false;
// 		} else if (!elementType.equals(other.elementType)) return false;
// 		return true;
// 	}
// 
// 	public Class getDeclaringClass () {
// 		return declaringClass;
// 	}
// 
// 	public Class getElementType () {
// 		return elementType;
// 	}
// 
// 	public Class getType () {
// 		return type;
// 	}
// 
// 	public String getName () {
// 		return name;
// 	}
// 
// 	public String toString () {
// 		return name;
// 	}
// 
// 	public int compareTo (Property o) {
// 		int comparison = name.compareTo(o.name);
// 		if (comparison != 0) {
// 			// Sort id and name above all other fields.
// 			if (name.equals("id")) return -1;
// 			if (o.name.equals("id")) return 1;
// 			if (name.equals("name")) return -1;
// 			if (o.name.equals("name")) return 1;
// 		}
// 		return comparison;
// 	}
// 
// 	abstract public void set (Object object, Object value) throws Exception;
// 
// 	abstract public Object get (Object object) throws Exception;
// }


import com.esotericsoftware.yamlbeans.Beans.Property;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

	public Object construct () throws InvocationTargetException {
		try {
			Object[] parameters = new Object[parameterValues.length];
			int i = 0;
			boolean missingParameter = false;
			for (ParameterValue parameter : parameterValues) {
				if (parameter == null)
					missingParameter = true;
				else
					parameters[i++] = parameter.value;
			}
			Object object;
			if (missingParameter) {
				try {
					object = constructor.getDeclaringClass().getConstructor().newInstance();
				} catch (Exception ex) {
					throw new InvocationTargetException(new YamlException("Missing constructor property: " + parameterNames[i]));
				}
			} else object = constructor.newInstance(parameters);
			for (PropertyValue propertyValue : propertyValues) {
				if (propertyValue.value != null)
					propertyValue.property.set(object, propertyValue.value);
			}
			return object;
		} catch (Exception ex) {
			throw new InvocationTargetException(ex, "Error constructing instance of class: "
				+ constructor.getDeclaringClass().getName());
		}
	}


// Path: src/com/esotericsoftware/yamlbeans/Beans.java
// static public abstract class Property implements Comparable<Property> {
// 	private final Class declaringClass;
// 	private final String name;
// 	private final Class type;
// 	private final Class elementType;
// 
// 	Property (Class declaringClass, String name, Class type, Type genericType) {
// 		this.declaringClass = declaringClass;
// 		this.name = name;
// 		this.type = type;
// 		this.elementType = getElementTypeFromGenerics(genericType);
// 	}
// 
// 	private Class getElementTypeFromGenerics (Type type) {
// 		if (type instanceof ParameterizedType) {
// 			ParameterizedType parameterizedType = (ParameterizedType)type;
// 			Type rawType = parameterizedType.getRawType();
// 
// 			if (isCollection(rawType) || isMap(rawType)) {
// 				Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
// 				if (actualTypeArguments.length > 0) {
// 					final Type cType = actualTypeArguments[actualTypeArguments.length - 1];
// 					if (cType instanceof Class) {
// 						return (Class)cType;
// 					} else if (cType instanceof WildcardType) {
// 						WildcardType t = (WildcardType)cType;
// 						final Type bound = t.getUpperBounds()[0];
// 						return bound instanceof Class ? (Class)bound : null;
// 					} else if (cType instanceof ParameterizedType) {
// 						ParameterizedType t = (ParameterizedType)cType;
// 						final Type rt = t.getRawType();
// 						return rt instanceof Class ? (Class)rt : null;
// 					}
// 				}
// 			}
// 		}
// 		return null;
// 	}
// 
// 	private boolean isMap (Type type) {
// 		return Map.class.isAssignableFrom((Class)type);
// 	}
// 
// 	private boolean isCollection (Type type) {
// 		return Collection.class.isAssignableFrom((Class)type);
// 	}
// 
// 	public int hashCode () {
// 		final int prime = 31;
// 		int result = 1;
// 		result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
// 		result = prime * result + ((name == null) ? 0 : name.hashCode());
// 		result = prime * result + ((type == null) ? 0 : type.hashCode());
// 		result = prime * result + ((elementType == null) ? 0 : elementType.hashCode());
// 		return result;
// 	}
// 
// 	public boolean equals (Object obj) {
// 		if (this == obj) return true;
// 		if (obj == null) return false;
// 		if (getClass() != obj.getClass()) return false;
// 		Property other = (Property)obj;
// 		if (declaringClass == null) {
// 			if (other.declaringClass != null) return false;
// 		} else if (!declaringClass.equals(other.declaringClass)) return false;
// 		if (name == null) {
// 			if (other.name != null) return false;
// 		} else if (!name.equals(other.name)) return false;
// 		if (type == null) {
// 			if (other.type != null) return false;
// 		} else if (!type.equals(other.type)) return false;
// 		if (elementType == null) {
// 			if (other.elementType != null) return false;
// 		} else if (!elementType.equals(other.elementType)) return false;
// 		return true;
// 	}
// 
// 	public Class getDeclaringClass () {
// 		return declaringClass;
// 	}
// 
// 	public Class getElementType () {
// 		return elementType;
// 	}
// 
// 	public Class getType () {
// 		return type;
// 	}
// 
// 	public String getName () {
// 		return name;
// 	}
// 
// 	public String toString () {
// 		return name;
// 	}
// 
// 	public int compareTo (Property o) {
// 		int comparison = name.compareTo(o.name);
// 		if (comparison != 0) {
// 			// Sort id and name above all other fields.
// 			if (name.equals("id")) return -1;
// 			if (o.name.equals("id")) return 1;
// 			if (name.equals("name")) return -1;
// 			if (o.name.equals("name")) return 1;
// 		}
// 		return comparison;
// 	}
// 
// 	abstract public void set (Object object, Object value) throws Exception;
// 
// 	abstract public Object get (Object object) throws Exception;
// }


// Path: src/com/esotericsoftware/yamlbeans/DeferredConstruction.java
import com.esotericsoftware.yamlbeans.Beans.Property;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

	public Object construct () throws InvocationTargetException {
		try {
			Object[] parameters = new Object[parameterValues.length];
			int i = 0;
			boolean missingParameter = false;
			for (ParameterValue parameter : parameterValues) {
				if (parameter == null)
					missingParameter = true;
				else
					parameters[i++] = parameter.value;
			}
			Object object;
			if (missingParameter) {
				try {
					object = constructor.getDeclaringClass().getConstructor().newInstance();
				} catch (Exception ex) {
					throw new InvocationTargetException(new YamlException("Missing constructor property: " + parameterNames[i]));
				}
			} else object = constructor.newInstance(parameters);
			for (PropertyValue propertyValue : propertyValues) {
				if (propertyValue.value != null)
					propertyValue.property.set(object, propertyValue.value);
			}
			return object;
		} catch (Exception ex) {
			throw new InvocationTargetException(ex, "Error constructing instance of class: "
				+ constructor.getDeclaringClass().getName());
		}
	}


	public void storeProperty (Property property, Object value) {
