mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
This commit is contained in:
parent
ee21f63823
commit
dd73e4c2b6
@ -159,6 +159,7 @@ public abstract class BaseSerializer<SubType extends BaseSerializer<SubType>> ex
|
||||
}
|
||||
strings[i] = toString(args.get(i),wrap);
|
||||
}
|
||||
// TODO : use faster custom rendering
|
||||
appendOperationResult(operator, String.format(pattern, strings));
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package com.mysema.query.serialization;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mysema.util.Assert;
|
||||
|
||||
/**
|
||||
* PatternElement provides
|
||||
*
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
public class OperationPattern {
|
||||
|
||||
// private static final Pattern patter
|
||||
|
||||
private final String pattern;
|
||||
|
||||
private final List<Element> elements = new ArrayList<Element>();
|
||||
|
||||
public OperationPattern(String pattern){
|
||||
this.pattern = Assert.notNull(pattern);
|
||||
}
|
||||
|
||||
public int hashCode(){
|
||||
return pattern.hashCode();
|
||||
}
|
||||
|
||||
public boolean equals(Object o){
|
||||
if (o == this){
|
||||
return true;
|
||||
}else if (o instanceof OperationPattern){
|
||||
return ((OperationPattern)o).pattern.equals(pattern);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class Element{
|
||||
|
||||
private final int index;
|
||||
|
||||
private final String text;
|
||||
|
||||
public Element(int index, String text){
|
||||
this.index = index;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,7 @@ import com.mysema.query.grammar.types.PathMetadata.PathType;
|
||||
* @author tiwe
|
||||
* @version $Id$
|
||||
*/
|
||||
// TODO : replace String.format based expressions with custom expressions
|
||||
public abstract class OperationPatterns{
|
||||
|
||||
private final Map<Op<?>,String> patterns = new HashMap<Op<?>,String>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user