001package io.ebean.querybean.generator; 002 003import java.util.Set; 004 005/** 006 * Property type for associated beans (OneToMany, ManyToOne etc). 007 */ 008public class PropertyTypeAssoc extends PropertyType { 009 010 /** 011 * The package name for this associated query bean. 012 */ 013 private final String assocPackage; 014 015 /** 016 * Construct given the associated bean type name and package. 017 * 018 * @param qAssocTypeName the associated bean type name. 019 * @param assocPackage the associated bean package. 020 */ 021 PropertyTypeAssoc(String qAssocTypeName, String assocPackage) { 022 super(qAssocTypeName); 023 this.assocPackage = assocPackage; 024 } 025 026 /** 027 * Returns true as associated bean type. 028 */ 029 @Override 030 public boolean isAssociation() { 031 return true; 032 } 033 034 /** 035 * All required imports to the allImports set. 036 */ 037 @Override 038 public void addImports(Set<String> allImports) { 039 allImports.add(assocPackage + "." + propertyType); 040 } 041 042// /** 043// * Write the constructor source code to writer. 044// */ 045// @Override 046// public void writeConstructor(Writer writer, String name, boolean assoc) throws IOException { 047// 048// writer.append(propertyType).append("<>(\"").append(name).append("\""); 049// if (assoc) { 050// //this.notes = new QAssocContactNote<>("notes", root, path, depth); 051// writer.append(", root, path, depth);").append(NEWLINE); 052// 053// } else { 054// // root level 055// writer.append(", this, ").append("maxDepth);").append(NEWLINE); 056// } 057// } 058}