@Test public void testAliasPrefix() throws Exception { DefaultAliasDecider aliasDecider = new DefaultAliasDecider("testAlias"); ASTNode node = HQLParser.parseExpr("tbl1.col1"); assertEquals(aliasDecider.decideAlias(node), "testAlias0"); assertEquals(aliasDecider.decideAlias(node), "testAlias1"); DefaultAliasDecider aliasDecider2 = new DefaultAliasDecider("testAlias"); DefaultAliasDecider aliasDecider3 = new DefaultAliasDecider(); assertEquals(aliasDecider2.decideAlias(node), "testAlias0"); assertEquals(aliasDecider3.decideAlias(node), "alias0"); assertEquals(aliasDecider.decideAlias(node), "testAlias2"); }
public String decideAlias(ASTNode node) { if (node == null) { throw new NullPointerException("Node cannot be null"); } return aliasPrefix + (counter++); }
DefaultAliasDecider implements AliasDecider { public String decideAlias(ASTNode node) { if (node == null) { throw new NullPointerException("Node cannot be null"); } return aliasPrefix + (counter++); } }
DefaultAliasDecider implements AliasDecider { public String decideAlias(ASTNode node) { if (node == null) { throw new NullPointerException("Node cannot be null"); } return aliasPrefix + (counter++); } DefaultAliasDecider(String alias);   DefaultAliasDecider(); }
DefaultAliasDecider implements AliasDecider { public String decideAlias(ASTNode node) { if (node == null) { throw new NullPointerException("Node cannot be null"); } return aliasPrefix + (counter++); } DefaultAliasDecider(String alias);   DefaultAliasDecider(); String decideAlias(ASTNode node); }
DefaultAliasDecider implements AliasDecider { public String decideAlias(ASTNode node) { if (node == null) { throw new NullPointerException("Node cannot be null"); } return aliasPrefix + (counter++); } DefaultAliasDecider(String alias);   DefaultAliasDecider(); String decideAlias(ASTNode node);  }