Create a match from a DomainObjectMatch specified in the context of another query
@param domainObjectMatch a match specified in the context of another query
@return a DomainObjectMatch
497650
@SuppressWarnings("unchecked")
	public <T> DomainObjectMatch<T> createMatchFrom(DomainObjectMatch<T> domainObjectMatch) {
		DomainObjectMatch<T> ret;
		FromPreviousQueryExpression pqe;
		DomainObjectMatch<?> match;
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(domainObjectMatch);
		if (delegate != null) { // generic model
			DomainObjectMatch<?> newDelegate = APIAccess.createDomainObjectMatch(delegate,
					this.queryExecutor.getDomainObjectMatches().size(),
					this.queryExecutor.getMappingInfo());
			this.queryExecutor.getDomainObjectMatches().add(newDelegate);
			pqe = new FromPreviousQueryExpression(
					newDelegate, delegate);
			ret = (DomainObjectMatch<T>) APIAccess.createDomainObjectMatch(DomainObject.class, newDelegate);
			match = newDelegate;
		} else {
			ret = APIAccess.createDomainObjectMatch(domainObjectMatch,
					this.queryExecutor.getDomainObjectMatches().size(),
					this.queryExecutor.getMappingInfo());
			this.queryExecutor.getDomainObjectMatches().add(ret);
			pqe = new FromPreviousQueryExpression(
					ret, domainObjectMatch);
			match = ret;
		}
		this.queryExecutor.addAstObject(pqe);
		QueryRecorder.recordAssignment(this, "createMatchFrom", match,
				QueryRecorder.reference(domainObjectMatch));
		return ret;
	}
1298483
protected CollectionMatch selectBestCollectionMatch(CollectionMatch previousMatch, CollectionMatch currentMatch) {

        CollectionMatch bestMatch = null;
        if (previousMatch == null) {
            bestMatch = currentMatch;
        } else if (previousMatch.isDenyMatchByOmission()) {
            bestMatch = previousMatch;
        } else if (currentMatch.isDenyMatchByOmission()) {
            bestMatch = currentMatch;
        } else if (previousMatch.isDenyMatch()) {
            bestMatch = previousMatch;
        } else if (currentMatch.isDenyMatch()) {
            bestMatch = currentMatch;
        } else if (previousMatch.isPermitMatch()) {
            bestMatch = previousMatch;
        } else if (currentMatch.isPermitMatch()) {
            bestMatch = currentMatch;
        } else if (previousMatch.isExactMatch()) {
            bestMatch = previousMatch;
        } else if (currentMatch.isExactMatch()) {
            bestMatch = currentMatch;
        } else if (previousMatch.isPathMatch() && previousMatch.getUrlPattern().length() >= currentMatch.getUrlPattern().length()) {
            bestMatch = previousMatch;
        } else {
            bestMatch = currentMatch;
        }
        return bestMatch;
    }
1314584
public ResultMatcher isNotEqualTo(final Object expected) {
        return new AbstractResultMatcher(path, configuration) {
            public void doMatch(Object actual) {
                Diff diff = createDiff(expected, actual);
                if (diff.similar()) {
                    failWithMessage("JSON is equal.");
                }
            }
        };
    }
1337747
public static <T> List<Option<T>> createOptions(Collection<T> domainObjects) { 
        List<Option<T>> options = new ArrayList<Option<T>>();
    
        for (T value : domainObjects) {
            String id = String.valueOf(getId(value));
            options.add(new Option<T>(id, value));
        }
    
        return options;
    }
198274
public static Matcher<TypeCastTree> typeCast(
      final Matcher<Tree> typeMatcher, final Matcher<ExpressionTree> expressionMatcher) {
    return new Matcher<TypeCastTree>() {
      @Override
      public boolean matches(TypeCastTree t, VisitorState state) {
        return typeMatcher.matches(t.getType(), state)
            && expressionMatcher.matches(t.getExpression(), state);
      }
    };
  }
1241263
static Subject createSubject(final SubjectFactory subjectFactory,
                                final String domain,
                                final ManagedConnectionFactory mcf)
   {
      if (System.getSecurityManager() == null)
      {
         Subject subject = subjectFactory.createSubject(domain);
         Set<PasswordCredential> s = getPasswordCredentials(subject);
         if (s != null && !s.isEmpty())
         {
            for (PasswordCredential pc : s)
            {
               pc.setManagedConnectionFactory(mcf);
            }
         }
         return subject;
      }

      return AccessController.doPrivileged(new PrivilegedAction<Subject>() 
      {
         public Subject run()
         {
            Subject subject = subjectFactory.createSubject(domain);
            Set<PasswordCredential> s = getPasswordCredentials(subject);
            if (s != null && !s.isEmpty())
            {
               for (PasswordCredential pc : s)
               {
                  pc.setManagedConnectionFactory(mcf);
               }
            }
            return subject;
         }
      });
   }
430356
public final QueryParser.regex_match_return regex_match() throws RecognitionException {
        QueryParser.regex_match_return retval = new QueryParser.regex_match_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token WS41=null;
        Token REGEX_MATCH42=null;
        Token WS43=null;
        QueryParser.field_return field40 = null;

        QueryParser.value_return value44 = null;


        CommonTree WS41_tree=null;
        CommonTree REGEX_MATCH42_tree=null;
        CommonTree WS43_tree=null;

        try {
            // src/riemann/Query.g:56:2: ( field ( WS )* REGEX_MATCH ( WS )* value )
            // src/riemann/Query.g:56:4: field ( WS )* REGEX_MATCH ( WS )* value
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_field_in_regex_match376);
            field40=field();

            state._fsp--;

            adaptor.addChild(root_0, field40.getTree());
            // src/riemann/Query.g:56:10: ( WS )*
            loop15:
            do {
                int alt15=2;
                int LA15_0 = input.LA(1);

                if ( (LA15_0==WS) ) {
                    alt15=1;
                }


                switch (alt15) {
            	case 1 :
            	    // src/riemann/Query.g:56:10: WS
            	    {
            	    WS41=(Token)match(input,WS,FOLLOW_WS_in_regex_match378); 
            	    WS41_tree = (CommonTree)adaptor.create(WS41);
            	    adaptor.addChild(root_0, WS41_tree);


            	    }
            	    break;

            	default :
            	    break loop15;
                }
            } while (true);

            REGEX_MATCH42=(Token)match(input,REGEX_MATCH,FOLLOW_REGEX_MATCH_in_regex_match381); 
            REGEX_MATCH42_tree = (CommonTree)adaptor.create(REGEX_MATCH42);
            root_0 = (CommonTree)adaptor.becomeRoot(REGEX_MATCH42_tree, root_0);

            // src/riemann/Query.g:56:27: ( WS )*
            loop16:
            do {
                int alt16=2;
                int LA16_0 = input.LA(1);

                if ( (LA16_0==WS) ) {
                    alt16=1;
                }


                switch (alt16) {
            	case 1 :
            	    // src/riemann/Query.g:56:27: WS
            	    {
            	    WS43=(Token)match(input,WS,FOLLOW_WS_in_regex_match384); 
            	    WS43_tree = (CommonTree)adaptor.create(WS43);
            	    adaptor.addChild(root_0, WS43_tree);


            	    }
            	    break;

            	default :
            	    break loop16;
                }
            } while (true);

            pushFollow(FOLLOW_value_in_regex_match387);
            value44=value();

            state._fsp--;

            adaptor.addChild(root_0, value44.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
646985
public static <T extends TypeDefinition> ElementMatcher.Junction<T> ofSort(ElementMatcher<? super TypeDefinition.Sort> matcher) {
        return new TypeSortMatcher<T>(matcher);
    }
654840
public <E> TerminalResult IN(DomainObjectMatch<E> domainObjects) {
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(domainObjects);
		DomainObjectMatch<?> match = delegate != null ? delegate : domainObjects;
		getPredicateExpression().setOperator(Operator.IN);
		getPredicateExpression().setValue_2(match);
		TerminalResult ret = APIAccess.createTerminalResult(this.getPredicateExpression());
		QueryRecorder.recordInvocation(this, "IN", ret, QueryRecorder.placeHolder(match));
		return ret;
	}
25388
protected String createQueryStringFromCriteria(Criteria criteria, @Nullable Class<?> domainType) {
		return createQueryStringFromNode(criteria, domainType);
	}
471479
public GetVerifiedDomainResponse getVerifiedDomain(GetVerifiedDomainRequest request) {
        checkNotNull(request, "object request should not be null.");
        assertStringNotNullOrEmpty(request.getDomainName(), "object domainName should not be null or empty");

        InternalRequest internalRequest =
                this.createRequest("verifiedDomain", request, HttpMethodName.GET, request.getDomainName());
        return this.invokeHttpClient(internalRequest, GetVerifiedDomainResponse.class);
    }
241372
public Traverse TRAVERSE_FROM(DomainObjectMatch<?> start) {
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(start);
		DomainObjectMatch<?> match = delegate != null ? delegate : start;
		TraversalExpression te = new TraversalExpression(match, this.queryExecutor);
		this.queryExecutor.addAstObject(te);
		Traverse ret = APIAccess.createTraverse(te);
		QueryRecorder.recordInvocation(this, "TRAVERSE_FROM", ret, QueryRecorder.placeHolder(match));
		return ret;
	}
895013
@Override
  public Iterable<BlockTemplateMatch> match(JCTree tree, Context context) {
    // TODO(lowasser): consider nonconsecutive matches?
    if (tree instanceof JCBlock) {
      JCBlock block = (JCBlock) tree;
      ImmutableList<JCStatement> targetStatements = ImmutableList.copyOf(block.getStatements());
      return matchesStartingAnywhere(block, 0, targetStatements, context)
          .first()
          .or(List.<BlockTemplateMatch>nil());
    }
    return ImmutableList.of();
  }
572324
@Override
	public Map<RuleSet, List<Rule>> matching(Rules rules,
	                                         Map<String, Object> vars,
	                                         boolean ignoreMethodErrors) throws OgnlException
	{
		Map<RuleSet, List<Rule>> ret = new HashMap<>();

		for (RuleSet ruleSet : rules.ruleSets)
		{
			try
			{
				OgnlContext context = createContext(vars);

				List<Rule> matching = match(ruleSet, context);

				if (!matching.isEmpty())
				{
					ret.put(ruleSet, matching);
				}
			}
			catch (MethodFailedException mfe)
			{

				if (!ignoreMethodErrors)
				{
					throw mfe;
				}

				log.warn("Method failed for ruleset " + ruleSet.id, mfe);
			}
		}

		return ret;
	}
207961
public <T> DomainObjectMatch<T> createMatch(Class<T> domainObjectType) {
		DomainObjectMatch<T> ret = createMatchInternal(domainObjectType);
		QueryRecorder.recordAssignment(this, "createMatch", ret,
				QueryRecorder.literal(domainObjectType.getName()));
		return ret;
	}
610399
public ValidationMatcher getValidationMatcher(String validationMatcherName) throws NoSuchValidationMatcherException {
        if (!members.containsKey(validationMatcherName)) {
            throw new NoSuchValidationMatcherException("Can not find validation matcher " + validationMatcherName + " in library " + name + " (" + prefix + ")");
        }

        return members.get(validationMatcherName);
    }
552127
public <U extends T> OngoingMatchingC1<T, U, U> when(MatchesAny<U> o) {
    List<Matcher<Object>> matchers = Lists.of(ArgumentMatchers.any());
    return new OngoingMatchingC1<>(
        this,
        new DecomposableMatchBuilder1<U, U>(matchers, 0, new IdentityFieldExtractor<>()).build());
  }