Restriction restriction = null;
// is it a literal? Does not include enums
if ( isRightLiteral ) {
restriction = buildLiteralRestriction( context,
extractor,
new LiteralRestrictionDescr( operator,
relDescr.isNegated(),
relDescr.getParameters(),
rightValue,
LiteralRestrictionDescr.TYPE_STRING ) ); // default type
if ( restriction == null ) {
// otherwise we just get wierd errors after this point on literals
continue;
}
} else {
// is it an enum?
int dotPos = rightValue.lastIndexOf( '.' );
if ( dotPos >= 0 ) {
final String mainPart = rightValue.substring( 0,
dotPos );
String lastPart = rightValue.substring( dotPos + 1 );
try {
final Class< ? > cls = context.getDialect().getTypeResolver().resolveType( mainPart );
if ( lastPart.indexOf( '(' ) < 0 && lastPart.indexOf( '.' ) < 0 && lastPart.indexOf( '[' ) < 0 ) {
restriction = buildLiteralRestriction( context,
extractor,
new LiteralRestrictionDescr( operator,
relDescr.isNegated(),
relDescr.getParameters(),
rightValue,
LiteralRestrictionDescr.TYPE_STRING ) ); // default type
}
} catch ( ClassNotFoundException e ) {
// do nothing as this is just probing to see if it was a class, which we now know it isn't :)
}
}
}
if ( restriction != null ) {
pattern.addConstraint( new LiteralConstraint( extractor,
(LiteralRestriction) restriction ) );
continue;
}
Declaration declr = null;
if ( rightValue.indexOf( '(' ) < 0 && rightValue.indexOf( '.' ) < 0 && rightValue.indexOf( '[' ) < 0 ) {
declr = context.getDeclarationResolver().getDeclaration( context.getRule(),
rightValue );
if ( declr == null ) {
// trying to create implicit declaration
final Pattern thisPattern = (Pattern) context.getBuildStack().peek();
declr = this.createDeclarationObject( context,
rightValue,
thisPattern );
if ( declr == null ) {
// maybe it was a class literal ?
try {
final Class< ? > cls = context.getDialect().getTypeResolver().resolveType( rightValue );
restriction = buildLiteralRestriction( context,
extractor,
new LiteralRestrictionDescr( operator,
relDescr.isNegated(),
relDescr.getParameters(),
cls.getName(),
LiteralRestrictionDescr.TYPE_STRING ) ); // default type
} catch ( ClassNotFoundException cnfe ) {