Analyze query string for el variables and creates el descriptor.

@param descriptor repository method descriptor
@param context    repository method context
499309
protected void analyzeElVars(final T descriptor, final DescriptorContext context) {
        descriptor.el = ElAnalyzer.analyzeQuery(context.generics, descriptor.command);
    }
1075453
private <T extends Describable<T>>
    Descriptor<T> findDescriptor(String shortClassName, Collection<? extends Descriptor<T>> descriptors) {
        String name = '.'+shortClassName;
        for (Descriptor<T> d : descriptors) {
            if(d.clazz.getName().endsWith(name))
                return d;
        }
        return null;
    }
715079
@Override
    public ClassContext analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException {

        JavaClass javaClass = analysisCache.getClassAnalysis(JavaClass.class, descriptor);
        ClassContext classContext = new ClassContext(javaClass, AnalysisContext.currentAnalysisContext());
        return classContext;
    }
649228
public void setDescriptor(String descriptor)
  {
    _descriptor = descriptor;

    if (_isWrite)
      _jClass.getConstantPool().addUTF8(descriptor);
  }
1260312
public StringBuilder buildSelectQuery(TableGeneratorDiscriptor descriptor)
    {
        StringBuilder builder = new StringBuilder("Select ");
        ensureCase(builder, descriptor.getValueColumnName(), false).append(" from ");
        ensureCase(builder, descriptor.getTable(), false).append(" where ");
        ensureCase(builder, descriptor.getPkColumnName(), false).append(" = '").append(
                descriptor.getPkColumnValue() + "'");

        return builder;
    }
200972
protected void extractPropertyDescriptor(java.beans.PropertyDescriptor propertyDescriptor, Object defaultInstance)
    {
        DefaultPropertyDescriptor desc = new DefaultPropertyDescriptor();

        Method writeMethod = propertyDescriptor.getWriteMethod();

        if (writeMethod != null) {
            Method readMethod = propertyDescriptor.getReadMethod();

            // is parameter hidden
            PropertyHidden parameterHidden = extractPropertyAnnotation(writeMethod, readMethod, PropertyHidden.class);

            if (parameterHidden == null) {
                // get parameter id
                PropertyId propertyId = extractPropertyAnnotation(writeMethod, readMethod, PropertyId.class);
                desc.setId(propertyId != null ? propertyId.value() : propertyDescriptor.getName());

                // set parameter type
                Type propertyType;
                if (readMethod != null) {
                    propertyType = readMethod.getGenericReturnType();
                } else {
                    propertyType = writeMethod.getGenericParameterTypes()[0];
                }
                desc.setPropertyType(propertyType);

                // get parameter display name
                PropertyName parameterName = extractPropertyAnnotation(writeMethod, readMethod, PropertyName.class);

                desc.setName(parameterName != null ? parameterName.value() : desc.getId());

                // get parameter description
                PropertyDescription parameterDescription =
                        extractPropertyAnnotation(writeMethod, readMethod, PropertyDescription.class);

                desc.setDescription(parameterDescription != null ? parameterDescription.value() : propertyDescriptor
                        .getShortDescription());

                Map<Class, Annotation> annotations = new HashMap<>();
                COMMON_ANNOTATION_CLASSES.forEach(aClass ->
                        annotations.put(aClass, extractPropertyAnnotation(writeMethod, readMethod, aClass))
                );

                setCommonProperties(desc, annotations);

                if (defaultInstance != null && readMethod != null) {
                    // get default value
                    try {
                        desc.setDefaultValue(readMethod.invoke(defaultInstance));
                    } catch (Exception e) {
                        LOGGER.error(MessageFormat.format(
                                "Failed to get default property value from getter {0} in class {1}",
                                readMethod.getName(),
                                this.beanClass), e);
                    }
                }

                desc.setWriteMethod(writeMethod);

                desc.setReadMethod(readMethod);

                this.parameterDescriptorMap.put(desc.getId(), desc);
            }
        }
    }
49496
protected Map<String, Object> createVariableForConstraint(final ConstraintDescriptor<?> descriptor) {
        
        final Map<String, Object> vars = new HashMap<String, Object>();
        
        for(Map.Entry<String, Object> entry : descriptor.getAttributes().entrySet()) {
            final String attrName = entry.getKey();
            final Object attrValue = entry.getValue();
            
            // メッセージ変数で必要ないものを除外する
            if(EXCLUDE_MESSAGE_ANNOTATION_ATTRIBUTES.contains(attrName)) {
                continue;
            }
            
            vars.put(attrName, attrValue);
        }
        
        return vars;
        
    }
346261
private void doCreateHelperForProp(final PropertyDescriptor propertyDescriptor,
      final BeanHelper parent, final TreeLogger logger, final GeneratorContext context)
      throws UnableToCompleteException {
    final Class<?> elementClass = propertyDescriptor.getElementClass();
    if (GwtSpecificValidatorCreator.isIterableOrMap(elementClass)) {
      if (parent.hasField(propertyDescriptor)) {
        final JClassType type = parent.getAssociationType(propertyDescriptor, true);

        this.createHelper(type.getErasedType(), logger, context);
      }
      if (parent.hasGetter(propertyDescriptor)) {
        final JClassType type = parent.getAssociationType(propertyDescriptor, false);

        this.createHelper(type.getErasedType(), logger, context);
      }
    } else {
      if (serverSideValidator.getConstraintsForClass(elementClass).isBeanConstrained()) {
        this.createHelper(elementClass, logger, context);
      }
    }
  }
408493
public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo(
      final EvaluatorDescriptor descriptor) {
    if (descriptor == null) {
      return null;
    }
    EvaluatorDescriptorInfo.NodeDescriptorInfo nodeDescriptorInfo = descriptor.getNodeDescriptor() == null ? null :
        EvaluatorDescriptorInfo.NodeDescriptorInfo.newBuilder()
            .setHostName(descriptor.getNodeDescriptor().getName())
            .setId(descriptor.getNodeDescriptor().getId())
            .setIpAddress(descriptor.getNodeDescriptor().getInetSocketAddress().getAddress().getHostAddress())
            .setPort(descriptor.getNodeDescriptor().getInetSocketAddress().getPort())
            .setRackName(descriptor.getNodeDescriptor().getRackDescriptor() == null ?
                "" : descriptor.getNodeDescriptor().getRackDescriptor().getName())
            .build();
    return EvaluatorDescriptorInfo.newBuilder()
        .setCores(descriptor.getNumberOfCores())
        .setMemory(descriptor.getMemory())
        .setRuntimeName(descriptor.getRuntimeName())
        .setNodeDescriptorInfo(nodeDescriptorInfo)
        .build();
  }
59169
protected function mapReflectorPropertiesOntoDescriptor(Function_ $reflector, FunctionDescriptor $descriptor): void
    {
        $packages = new Collection();
        $package = $this->extractPackageFromDocBlock($reflector->getDocBlock());
        //TODO: this looks like a potential bug. Have to investigate this!
        if ($package) {
            $tag = new TagDescriptor('package');
            $tag->setDescription($package);
            $packages->add($tag);
        }

        $descriptor->getTags()->set('package', $packages);

        $descriptor->setFullyQualifiedStructuralElementName($reflector->getFqsen());
        $descriptor->setName($reflector->getName());
        $descriptor->setLine($reflector->getLocation()->getLineNumber());
        $descriptor->setNamespace('\\' . trim(substr(
            (string) $reflector->getFqsen(),
            0,
            -strlen($reflector->getName()) - 2
        ), '\\'));
        $descriptor->setReturnType($reflector->getReturnType());
    }
481060
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) {
        PageComponent pageComponent = descriptor.createPageComponent();
        pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent)));
        if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) {
            getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent);
        }

        return pageComponent;
    }
22236
public RuleConditionElement build(final RuleBuildContext context,
                                      final BaseDescr descr,
                                      final Pattern prefixPattern) {
        boolean typesafe = context.isTypesafe();
        // it must be an EvalDescr
        final EvalDescr evalDescr = (EvalDescr) descr;

        try {
            MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );

            Map<String, Declaration> decls = context.getDeclarationResolver().getDeclarations(context.getRule());
            
            AnalysisResult analysis = context.getDialect().analyzeExpression( context,
                                                                              evalDescr,
                                                                              evalDescr.getContent(),
                                                                              new BoundIdentifiers( DeclarationScopeResolver.getDeclarationClasses( decls ),
                                                                                                    context ) );

            final BoundIdentifiers usedIdentifiers = analysis.getBoundIdentifiers();
            int i = usedIdentifiers.getDeclrClasses().keySet().size();
            Declaration[] previousDeclarations = new Declaration[i];
            i = 0;
            for ( String id :  usedIdentifiers.getDeclrClasses().keySet() ) {
                previousDeclarations[i++] = decls.get( id );
            }
            Arrays.sort( previousDeclarations, SortDeclarations.instance  ); 
            
            MVELCompilationUnit unit = dialect.getMVELCompilationUnit( (String) evalDescr.getContent(),
                                                                       analysis,
                                                                       previousDeclarations,
                                                                       null,
                                                                       null,
                                                                       context,
                                                                       "drools",
                                                                       KnowledgeHelper.class,
                                                                       false,
                                                                       MVELCompilationUnit.Scope.EXPRESSION );
            final EvalCondition eval = new EvalCondition( previousDeclarations );

            MVELEvalExpression expr = new MVELEvalExpression( unit,
                                                              dialect.getId() );
            eval.setEvalExpression( KiePolicyHelper.isPolicyEnabled() ? new SafeEvalExpression(expr) : expr );

            MVELDialectRuntimeData data = (MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
            data.addCompileable( eval,
                                  expr );

            expr.compile( data, context.getRule() );
            return eval;
        } catch ( final Exception e ) {
            copyErrorLocation(e, evalDescr);
            context.addError( new DescrBuildError( context.getParentDescr(),
                                                          evalDescr,
                                                          e,
                                                          "Unable to build expression for 'eval':" + e.getMessage() + " '" + evalDescr.getContent() + "'" ) );
            return null;
        } finally {
            context.setTypesafe( typesafe );
        }
    }
693876
protected void validatePluginDescriptor(PluginDescriptor descriptor) throws PluginException {
        if (StringUtils.isNullOrEmpty(descriptor.getPluginId())) {
            throw new PluginException("Field 'id' cannot be empty");
        }

        if (descriptor.getVersion() == null) {
            throw new PluginException("Field 'version' cannot be empty");
        }
    }
347555
private void prepareModel(DescriptorRepository model)
    {
        TreeMap result = new TreeMap();

        for (Iterator it = model.getDescriptorTable().values().iterator(); it.hasNext();)
        {
            ClassDescriptor classDesc = (ClassDescriptor)it.next();

            if (classDesc.getFullTableName() == null)
            {
                // not mapped to a database table
                continue;
            }

            String elementName        = getElementName(classDesc);
            Table  mappedTable        = getTableFor(elementName);
            Map    columnsMap         = getColumnsFor(elementName);
            Map    requiredAttributes = getRequiredAttributes(elementName);
            List   classDescs         = getClassDescriptorsMappingTo(elementName);

            if (mappedTable == null)
            {
                mappedTable = _schema.findTable(classDesc.getFullTableName());
                if (mappedTable == null)
                {
                    continue;
                }
                columnsMap         = new TreeMap();
                requiredAttributes = new HashMap();
                classDescs         = new ArrayList();
                _elementToTable.put(elementName, mappedTable);
                _elementToClassDescriptors.put(elementName, classDescs);
                _elementToColumnMap.put(elementName, columnsMap);
                _elementToRequiredAttributesMap.put(elementName, requiredAttributes);
            }
            classDescs.add(classDesc);
            extractAttributes(classDesc, mappedTable, columnsMap, requiredAttributes);
        }
        extractIndirectionTables(model, _schema);
    }
291979
private void findPluginsForDescriptor(final CommandLinePluginDescriptor<?> pluginDescriptor)
    {
        final ClassFinder classFinder = new ClassFinder();
        pluginDescriptor.getPackageNames().forEach(
                pkg -> classFinder.find(pkg, pluginDescriptor.getPluginBaseClass()));
        final Set<Class<?>> pluginClasses = classFinder.getClasses();

        for (Class<?> c : pluginClasses) {
            if (pluginDescriptor.includePluginClass(c)) {
                try {
                    final Object plugin = pluginDescriptor.createInstanceForPlugin(c);
                    createArgumentDefinitions(plugin, pluginDescriptor);
                } catch (InstantiationException | IllegalAccessException e) {
                    throw new CommandLineException.CommandLineParserInternalException("Problem making an instance of plugin " + c +
                            " Do check that the class has a non-arg constructor", e);
                }
            }
        }
    }
749845
public MethodDescriptor[] 
    getTeaContextMethodDescriptors(Class<?>[] contextClasses) {

        Vector<MethodDescriptor> v = new Vector<MethodDescriptor>();
        Hashtable<Method, Method> methods = new Hashtable<Method, Method>();

        if (contextClasses != null) {

            // Combine all of the MethodDescriptors

            for (int i = 0; i < contextClasses.length; i++) {
                Class<?> c = contextClasses[i];
                if (c == null) {
                    continue;
                }

                MethodDescriptor[] mds = 
                    getTeaContextMethodDescriptors(c, false);
                
                for (int j = 0; j < mds.length; j++) {
                    MethodDescriptor md = mds[j];
                    Method m = md.getMethod();
                    // Check uniqueness of method
                    if (methods.get(m) == null) {
                        methods.put(m, m);
                        v.addElement(md);
                    }
                }
            }
        }

        MethodDescriptor[] methodDescriptors = new MethodDescriptor[v.size()];
        v.copyInto(methodDescriptors);

        // Sort the combined results
        sortMethodDescriptors(methodDescriptors);

        return methodDescriptors;
    }
573195
protected function retrieveIndexOfFieldDescriptor(
        FieldDescriptorInterface $fieldDescriptor,
        array $fieldDescriptors
    ) {
        foreach ($fieldDescriptors as $index => $other) {
            if ($fieldDescriptor->compare($other)) {
                return $index;
            }
        }

        return false;
    }