1010import java .util .HashMap ;
1111import java .util .Map ;
1212
13- public class HSchema extends QView {
13+ public class HSchema extends HModel {
1414 private final Class <? extends QView > entityType ;
15+ private final String tableName ;
1516 private Map <String , QJoin > joins ;
1617 private Map <String , QLambda > lambdas ;
1718 private Map <String , String > properties ;
1819
1920 private static final HashMap <Class <?>, HSchema > relations = new HashMap <>();
2021
2122 public HSchema (Class <? extends QView > entityType ) {
22- super (getTableName (entityType ));
2323 this .entityType = entityType ;
24+ this .tableName = (getTableName (entityType ));
2425 }
2526
2627 static String getTableName (Class <? extends QView > entityType ) {
@@ -35,33 +36,33 @@ public String translateProperty(String property) {
3536 String alias = property .substring (0 , p );
3637 String name = property .substring (p + 1 );
3738 String [] joinStack = alias .split ("@" );
38- QView view = getView (this , joinStack );
39- property = view .translateProperty (name );
39+ HModel model = getModel (this , joinStack );
40+ property = model .translateProperty (name );
4041 } else {
4142 property = properties .get (property );
4243 }
4344 return property ;
4445 }
4546
46- private static QView getView ( QView view , String [] joinStack ) {
47+ private static HModel getModel ( HModel model , String [] joinStack ) {
4748 for (String alias : joinStack ) {
4849 if (alias .isEmpty ()) continue ;
49- view .initialize ();
50- view = view .getJoin (alias ).getTargetRelation ();
50+ model .initialize ();
51+ model = model .getJoin (alias ).getTargetRelation ();
5152 }
52- return view ;
53+ return model ;
5354 }
5455
5556 public QLambda getLambda (String alias ) {
5657 return lambdas .get (alias );
5758 }
5859 public QLambda getLambda (String [] joinPath , String property ) {
5960 initialize ();
60- QView view = getView (this , joinPath );
61- return view .getLambda (property );
61+ HModel model = getModel (this , joinPath );
62+ return model .getLambda (property );
6263 }
6364
64- public static HSchema getView (Class <? extends QView > clazz ) { return relations .get (clazz ); }
65+ public static HSchema getSchema (Class <? extends QView > clazz ) { return relations .get (clazz ); }
6566
6667 public static HSchema registerSchema (Class <? extends QView > clazz ) {
6768 HSchema relation = relations .get (clazz );
@@ -106,8 +107,19 @@ else if (QLambda.class.isAssignableFrom(propertyType)) {
106107 this .joins = joins ;
107108 }
108109
109- public String getJoinTarget () {
110- return super .getQuery ();
110+ @ Override
111+ protected HSchema loadSchema () {
112+ return this ;
113+ }
114+
115+ @ Override
116+ protected String getQuery () {
117+ return "" ;
118+ }
119+
120+ @ Override
121+ protected String getTableName () {
122+ return this .tableName ;
111123 }
112124
113125 public QJoin getJoin (String join ) {
0 commit comments