Prpeare generated field statement.

@param  FieldInterface          $source_field
@param  ValueExtractorInterface $extractor
@return string
421504
public function prepareGeneratedFieldStatement(FieldInterface $source_field, ValueExtractorInterface $extractor)
    {
        $generated_field_name = $this->getConnection()->escapeFieldName($extractor->getFieldName());

        switch ($extractor->getValueCaster()) {
            case ValueCasterInterface::CAST_INT:
                $field_type = 'INT';
                break;
            case ValueCasterInterface::CAST_FLOAT:
                $field_type = 'DECIMAL(12, 2)';
                break;
            case ValueCasterInterface::CAST_BOOL:
                $field_type = 'TINYINT(1) UNSIGNED';
                break;
            case ValueCasterInterface::CAST_DATE:
                $field_type = 'DATE';
                break;
            case ValueCasterInterface::CAST_DATETIME:
                $field_type = 'DATETIME';
                break;
            case ValueCasterInterface::CAST_JSON:
                $field_type = 'JSON';
                break;
            default:
                $field_type = 'VARCHAR(191)';
        }

        $expression = $this->prepareGeneratedFieldExpression(
            $this->getConnection()->escapeFieldName($source_field->getName()),
            var_export($extractor->getExpression(), true),
            $extractor->getValueCaster(),
            $this->getConnection()->escapeValue($extractor->getDefaultValue())
        );
        $storage = $extractor->getStoreValue() ? 'STORED' : 'VIRTUAL';

        return trim("$generated_field_name $field_type AS ($expression) $storage");
    }
1198765
private void createImplicitFieldType(XtextResource resource, IAcceptor<? super ICodeMining> acceptor) {
		createImplicitVarValType(resource, acceptor, XtendField.class,
			it -> it.getType(),
			it -> {
				final JvmField inferredField = (JvmField) this.jvmModelAssocitions.getPrimaryJvmElement(it);
				if (inferredField == null || inferredField.getType() == null || inferredField.getType().eIsProxy()) {
					return null;
				}
				return inferredField.getType().getSimpleName();
			},
			null,
			() -> this.grammar.getAOPMemberAccess().getInitialValueAssignment_2_3_3_1());
	}
285267
public function getFieldsInQuery()
    {
        $query = isset($this->query['query']) ? $this->query['query'] : array();
        $sort = isset($this->query['sort']) ? $this->query['sort'] : array();

        $extractor = new FieldExtractor($query, $sort);
        return $extractor->getFields();
    }
221309
public function canExtract($source, $target, ExtractionContextInterface $extractionContext)
    {
        if(!$target instanceof Schema) {
            return false;
        }

        if(!$extractionContext->hasParameter('controller-reflection-method')) {
            return false;
        }

        return true;
    }
504792
public function describeValue(Exporter $exporter, $value): string
    {
        $refMethod = new \ReflectionMethod(get_class($this->constraint), 'failureDescription');
        $refMethod->setAccessible(true);
        return $refMethod->invoke($this->constraint, $value);
    }
703110
public static function getAncestors($source,$idField,$pidField,$fieldValue,$includeSelf=true)
    {
        $returnValue=[];
        $current=null;
        foreach($source as $row){
            $idValue=Convert::getFieldValue($row, $idField,true);
            if($idValue==$fieldValue){
                $current=$row;
                if($includeSelf){
                    $returnValue[]=$current;
                }
                break;
            }
        }
        $pidValue=Convert::getFieldValue($current, $pidField,true);
        while($pidValue){
            $current=self::_getAncestors($source,$idField,$pidValue);
            if(!empty($current)){
                $returnValue[]=$current;
                $pidValue=Convert::getFieldValue($current, $pidField,true);
            }else{
                break;
            }
        }

        //echo $returnValue[1][$idField];
        return array_reverse($returnValue);
    }
498162
protected function generateExtensionField(Entity $entity, FieldDescriptorProto $field)
    {
        $name     = $field->getName();
        $number   = $field->getNumber();
        $docBlock = $this->getDocBlockType($field);
        $type     = $this->getFieldTypeName($field);
        $label    = $this->getFieldLabelName($field);
        $property = PropertyGenerator::fromArray([
            'static'       => true,
            'name'         => $name,
            'visibility'   => PropertyGenerator::VISIBILITY_PROTECTED,
            'docblock'     => [
                'shortDescription' => "Extension field : $name $label $type = $number",
                'tags'             => [
                    [
                        'name'        => 'var',
                        'description' => '\Protobuf\Extension',
                    ]
                ]
            ]
        ]);

        $property->getDocblock()->setWordWrap(false);

        return $property;
    }
188235
protected function generateFieldWriteStatement(Entity $entity, FieldDescriptorProto $field)
    {
        $generator = new WriteFieldStatementGenerator($this->context);
        $statement = $generator->generateFieldWriteStatement($entity, $field);

        return $statement;
    }
830368
public final void copyPrimitiveField(Object source, Object copy, Field field) {
		copyPrimitiveAtOffset(source, copy, field.getType(), getObjectFieldOffset(field));
	}
916481
private void outputInterfaceField(GinjectorBindings bindings, SourceWriteUtil sourceWriteUtil,
      SourceWriter writer) {

    // Only the root injector has an interface binding.
    if (bindings.getParent() != null) {
      return;
    }

    Class<?> boundGinjectorInterface = getBoundGinjector(bindings);

    if (boundGinjectorInterface == null) {
      // Sanity-check: if this fails, then we somehow didn't bind the injector
      // interface in the root module (the root module should always generate a
      // binding for the injector).
      errorManager.logError("Injector interface not bound in the root module.");
      return;
    }

    NameGenerator nameGenerator = bindings.getNameGenerator();
    String fieldName = nameGenerator.getGinjectorInterfaceFieldName();
    String getterName = nameGenerator.getGinjectorInterfaceGetterMethodName();

    writer.beginJavaDocComment();
    writer.print("The implementation of " + boundGinjectorInterface);
    writer.endJavaDocComment();
    writer.println("private final %s %s;", boundGinjectorInterface.getCanonicalName(), fieldName);

    sourceWriteUtil.writeMethod(writer,
        String.format("public %s %s()", boundGinjectorInterface.getCanonicalName(), getterName),
        String.format("return %s;", fieldName));
  }
1074059
private function getConceptAspectQName( $sourceFact, $evaluationResult, $log )
	{
		// Get the concept name from the source
		if ( is_null( $this->conceptRule ) )
		{
			if ( is_null( $sourceFact ) )
			{
				return null;
			}

			// Make sure the namespace is valid in the instance document and use the instance document prefix if different
			// BMS 2018-03-01 Using the function getPrefixForDocumentNamespace can be a problem because if more than one
			//				  prefix references the same namespace then only the last prefix in the original namespace list
			//				  will be returned.  Instead, look for a namespace for the prefix.  If one exists then the prefix
			//				  is OK.  If not then look up an alternative prefix. Or failing that, add the fact's prefix and
			//				  namespace to the document's namespace collection
			// $instancePrefix =  $this->xbrlInstance->getPrefixForDocumentNamespace( $conceptQName->namespaceURI );
			$namespace = $this->xbrlInstance->getNamespaceForPrefix( $sourceFact->getPrefix() );
			$instancePrefix = $namespace && $namespace == $sourceFact->getNamespaceURI()
				? $instancePrefix = $sourceFact->getPrefix()
				: $this->xbrlInstance->getPrefixForDocumentNamespace( $sourceFact->getNamespaceURI() );
			if ( ! $instancePrefix )
			{
				$this->xbrlInstance->addNamespace( $sourceFact->getPrefix(), $sourceFact->getNamespaceURI() );
				$instancePrefix = $sourceFact->getPrefix();
			}

			return new QName( $instancePrefix, $sourceFact->getNamespaceURI(), $sourceFact->getLocalName() );
		}
		else
		{
			/**
			 * @var Concept $concept
			 */
			$concept = Concept::fromArray( $this->conceptRule );
			// This function will throw an exception if there is a problem so there is no return value to check
			$this->checkSAVConflicts( $concept->source, ASPECT_CONCEPT, $evaluationResult, $log );
			/**
			 * @var QName $conceptQName
			 */
			$conceptQName = $concept->getValue( $this, $evaluationResult, $log );
			// BMS 2018-03-01 See comments above with the same date
			// $instancePrefix =  $this->xbrlInstance->getPrefixForDocumentNamespace( $conceptQName->namespaceURI );
			$namespace = $this->xbrlInstance->getNamespaceForPrefix( $conceptQName->prefix );
			$instancePrefix = $namespace && $namespace == $conceptQName->namespaceURI
				? $instancePrefix = $conceptQName->prefix
				: $this->xbrlInstance->getPrefixForDocumentNamespace( $conceptQName->namespaceURI );
			if ( ! $instancePrefix )
			{
				$this->xbrlInstance->addNamespace( $conceptQName->prefix, $conceptQName->namespaceURI );
				$instancePrefix = $conceptQName->prefix;
			}
			$conceptQName->prefix = $instancePrefix;
			return $conceptQName;
		}

	}
753056
public function getSourceFactWithErrorLogging( $source, $evaluationResult, $aspect, $log )
	{
		$result = $this->getSourceFact( $source, $evaluationResult, $aspect, $log );
		if ( $result ) return $result;

		$log->formula_validation( "Formula", "Invalid or missing source fact",
			array(
				'source' => $source,
				'error' => 'xffe:InvalidSource'
			)
		);
	}
797415
private function getSourceType($source_area)
    {
        $type = $source_area->find('small', 0)->plaintext;
        $type = str_replace(['(', ')'], '', $type);
        $this->_type = strtolower($type);

        return strtolower($type);
    }
257723
public function buildContentFieldValue(FormBuilderInterface $builder, FieldInterface $field)
    {
        $builder->add('value', $this->getFormFieldType(), array_merge(
            $this->getDefaultFormFieldValueOptions($field),
            $this->getFormFieldValueOptions($field)
        ));

        $modelTransformer = $this->getValueModelTransformer($field);
        if ($modelTransformer !== null) {
            $builder->get('value')
                ->addModelTransformer($modelTransformer);
        }
    }
767876
public function getValue(SourceInterface $source)
    {
        $value = $this->value;

        if ($this->isTrim) {
            $value = trim($value);
        }

        if ($this->isIgnoreEmpty && empty($value)) {
            throw new IgnoreFieldException();
        }

        return $value;
    }
1072740
public static function field($descriptor, $name = null)
    {
        if (is_a($descriptor, 'frictionlessdata\\tableschema\\Fields\\BaseField')) {
            return $descriptor;
        } else {
            if (Utils::isJsonString($descriptor)) {
                $descriptor = json_decode($descriptor);
            } elseif (is_array($descriptor)) {
                $descriptor = json_decode(json_encode($descriptor));
            }
            if (!isset($descriptor->name) && !is_null($name)) {
                $descriptor->name = $name;
            }
            foreach (static::$fieldClasses as $fieldClass) {
                /** @var BaseField $fieldClass */
                if ($field = $fieldClass::inferDescriptor($descriptor)) {
                    return $field;
                }
            }
            throw new FieldValidationException([
                new SchemaValidationError(
                    SchemaValidationError::SCHEMA_VIOLATION,
                    'Could not find a valid field for descriptor: '.json_encode($descriptor)),
            ]);
        }
    }
539591
protected static function extract_object_from_record($record, $prefix, $additionalfields = []) {
        $object = new \stdClass();
        foreach ($record as $key => $value) {
            if (preg_match('/^'.preg_quote($prefix, '/').'(.*)/', $key, $matches)) {
                $object->{$matches[1]} = $value;
            }
        }
        if ($additionalfields) {
            foreach ($additionalfields as $key => $value) {
                $object->$key = $value;
            }
        }
        return $object;
    }