// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/ListType.java
// public class ListType extends Type {
// 	private Type _itemType;
// 	
// 	public ListType(Type itemType) {
// 		super("list", "java.util.List<" + itemType.getJavaType() + ">");
// 		_itemType = itemType;
// 	}
// 
// 	public Type getItemType() {
// 		return _itemType;
// 	}
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/PrimitiveType.java
// public class PrimitiveType extends Type {
// 	private final String _javaBoxedType;
// 
// 	public PrimitiveType(String guiceyType, String javaType, String javaBoxedType) {
// 		super(guiceyType, javaType);
// 		_javaBoxedType = javaBoxedType;
// 	}
// 	
// 	public String getJavaBoxedType() {
// 		return _javaBoxedType;
// 	}
// 	
// 	public static PrimitiveType DoubleType = new PrimitiveType("double", "double", "Double");
// 	public static PrimitiveType FloatType = new PrimitiveType("float", "float", "Float");
// 	public static PrimitiveType Int32Type = new PrimitiveType("int32", "int", "Integer");
// 	public static PrimitiveType Int64Type = new PrimitiveType("int64", "long", "Long");
// 	public static PrimitiveType BoolType = new PrimitiveType("bool", "boolean", "Boolean");
// 	public static PrimitiveType StringType = new PrimitiveType("string", "String", "String");
// //	public static PrimitiveType BytesType = new PrimitiveType("bytes", "", ""); // byte[]??
// 	public static PrimitiveType DateType = new PrimitiveType("date", "java.util.Date", "java.util.Date");
// 	
// 	public static PrimitiveType ObjectIdType = new PrimitiveType("object_id", "org.bson.types.ObjectId", "org.bson.types.ObjectId");
// 	public static PrimitiveType DBObjectType = new PrimitiveType("db_object", "com.mongodb.DBObject", "com.mongodb.DBObject");
// 	public static PrimitiveType DBTimestampType = new PrimitiveType("db_timestamp", "org.bson.types.BSONTimestamp", "org.bson.types.BSONTimestamp");
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/Type.java
// public class Type {
// 	protected String _guiceyType;
// 	protected String _javaType;
// 
// 	protected Type(String guiceyType) {
// 		_guiceyType = guiceyType;
// 	}
// 
// 	protected Type(String guiceyType, String javaType) {
// 		_guiceyType = guiceyType;
// 		_javaType = javaType;
// 	}
// 	
// 	public String getGuiceyType() {
// 		return _guiceyType;
// 	}
// 	
// 	public String getJavaType() {
// 		return _javaType;
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return _javaType;
// 	}
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/UserDataType.java
// public class UserDataType extends UserType {
// 	private final List<Property<?>> _properties = Lists.newArrayList();
// 	private final List<UserType> _childTypes = Lists.newArrayList();
// 	
// 	private Property<?> _identityProperty;
// 	
// 	public UserDataType(String guiceyType) {
// 		super(guiceyType);
// 	}
// 
// 	public List<Property<?>> getProperties() {
// 		return _properties;
// 	}
// 	
// 	public void addProperty(Property<?> property) {
// 		_properties.add(property);
// 	}
// 	
// 	public List<UserType> getChildTypes() {
// 		return _childTypes;
// 	}
// 	
// 	public void addChildType(UserType childType) {
// 		if (_childTypes.indexOf(childType) == -1) {
// 			_childTypes.add(childType);
// 			childType.setParentType(this);
// 		}
// 	}
// 	
// 	public Property<?> getIdentityProperty() {
// 		return _identityProperty;
// 	}
// 	
// 	public void setIdentityProperty(Property<?> identityProperty) {
// 		_identityProperty = identityProperty;
// 	}
// }


import com.lowereast.guiceymongo.data.generator.type.ListType;
import com.lowereast.guiceymongo.data.generator.type.PrimitiveType;
import com.lowereast.guiceymongo.data.generator.type.Type;
import com.lowereast.guiceymongo.data.generator.type.UserDataType;
/**
 *      Copyright (C) 2010 Lowereast Software
 *
 *   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 com.lowereast.guiceymongo.data.generator.property;


public class ListProperty extends Property<ListType> {
	public ListProperty(UserDataType enclosingType, String name, ListType type, String comment, boolean useCamelCaseKeys) {
		super(enclosingType, name, type, comment, useCamelCaseKeys);
	}

	@Override
	public String getMemberVariableName() {
		return super.getMemberVariableName() + "List";
	}

	public String getItemType() {
		return super.getType().getItemType().getJavaType();
	}
	
	public String getListItemType() {
		Type type = super.getType().getItemType();
		if (type instanceof PrimitiveType)
			return ((PrimitiveType)type).getJavaBoxedType();
		return type.getJavaType();
	}
	
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/ListType.java
// public class ListType extends Type {
// 	private Type _itemType;
// 	
// 	public ListType(Type itemType) {
// 		super("list", "java.util.List<" + itemType.getJavaType() + ">");
// 		_itemType = itemType;
// 	}
// 
// 	public Type getItemType() {
// 		return _itemType;
// 	}
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/PrimitiveType.java
// public class PrimitiveType extends Type {
// 	private final String _javaBoxedType;
// 
// 	public PrimitiveType(String guiceyType, String javaType, String javaBoxedType) {
// 		super(guiceyType, javaType);
// 		_javaBoxedType = javaBoxedType;
// 	}
// 	
// 	public String getJavaBoxedType() {
// 		return _javaBoxedType;
// 	}
// 	
// 	public static PrimitiveType DoubleType = new PrimitiveType("double", "double", "Double");
// 	public static PrimitiveType FloatType = new PrimitiveType("float", "float", "Float");
// 	public static PrimitiveType Int32Type = new PrimitiveType("int32", "int", "Integer");
// 	public static PrimitiveType Int64Type = new PrimitiveType("int64", "long", "Long");
// 	public static PrimitiveType BoolType = new PrimitiveType("bool", "boolean", "Boolean");
// 	public static PrimitiveType StringType = new PrimitiveType("string", "String", "String");
// //	public static PrimitiveType BytesType = new PrimitiveType("bytes", "", ""); // byte[]??
// 	public static PrimitiveType DateType = new PrimitiveType("date", "java.util.Date", "java.util.Date");
// 	
// 	public static PrimitiveType ObjectIdType = new PrimitiveType("object_id", "org.bson.types.ObjectId", "org.bson.types.ObjectId");
// 	public static PrimitiveType DBObjectType = new PrimitiveType("db_object", "com.mongodb.DBObject", "com.mongodb.DBObject");
// 	public static PrimitiveType DBTimestampType = new PrimitiveType("db_timestamp", "org.bson.types.BSONTimestamp", "org.bson.types.BSONTimestamp");
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/Type.java
// public class Type {
// 	protected String _guiceyType;
// 	protected String _javaType;
// 
// 	protected Type(String guiceyType) {
// 		_guiceyType = guiceyType;
// 	}
// 
// 	protected Type(String guiceyType, String javaType) {
// 		_guiceyType = guiceyType;
// 		_javaType = javaType;
// 	}
// 	
// 	public String getGuiceyType() {
// 		return _guiceyType;
// 	}
// 	
// 	public String getJavaType() {
// 		return _javaType;
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return _javaType;
// 	}
// }
// 
// Path: src/main/java/com/lowereast/guiceymongo/data/generator/type/UserDataType.java
// public class UserDataType extends UserType {
// 	private final List<Property<?>> _properties = Lists.newArrayList();
// 	private final List<UserType> _childTypes = Lists.newArrayList();
// 	
// 	private Property<?> _identityProperty;
// 	
// 	public UserDataType(String guiceyType) {
// 		super(guiceyType);
// 	}
// 
// 	public List<Property<?>> getProperties() {
// 		return _properties;
// 	}
// 	
// 	public void addProperty(Property<?> property) {
// 		_properties.add(property);
// 	}
// 	
// 	public List<UserType> getChildTypes() {
// 		return _childTypes;
// 	}
// 	
// 	public void addChildType(UserType childType) {
// 		if (_childTypes.indexOf(childType) == -1) {
// 			_childTypes.add(childType);
// 			childType.setParentType(this);
// 		}
// 	}
// 	
// 	public Property<?> getIdentityProperty() {
// 		return _identityProperty;
// 	}
// 	
// 	public void setIdentityProperty(Property<?> identityProperty) {
// 		_identityProperty = identityProperty;
// 	}
// }


// Path: src/main/java/com/lowereast/guiceymongo/data/generator/property/ListProperty.java
import com.lowereast.guiceymongo.data.generator.type.ListType;
import com.lowereast.guiceymongo.data.generator.type.PrimitiveType;
import com.lowereast.guiceymongo.data.generator.type.Type;
import com.lowereast.guiceymongo.data.generator.type.UserDataType;

/**
 *      Copyright (C) 2010 Lowereast Software
 *
 *   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 com.lowereast.guiceymongo.data.generator.property;


public class ListProperty extends Property<ListType> {
	public ListProperty(UserDataType enclosingType, String name, ListType type, String comment, boolean useCamelCaseKeys) {
		super(enclosingType, name, type, comment, useCamelCaseKeys);
	}

	@Override
	public String getMemberVariableName() {
		return super.getMemberVariableName() + "List";
	}

	public String getItemType() {
		return super.getType().getItemType().getJavaType();
	}
	
	public String getListItemType() {
		Type type = super.getType().getItemType();
		if (type instanceof PrimitiveType)
			return ((PrimitiveType)type).getJavaBoxedType();
		return type.getJavaType();
	}
	
	public String getBuilderItemType() {