protected function generateAbstractProperty($directory)
    {
        $class = new PhpClass();
        $class
            ->setDescription('Abstract class AbstractProperty.')
            ->setQualifiedName('SecIT\\SchemaOrg\\Mapping\\Property\\AbstractProperty')
            ->addInterface($this->propertyInterfaceName)
            ->setAbstract(true)
        ;

        $constructorBody = 'if ($value !== null) {'."\n";
        $constructorBody .= '   $this->setValue($value);'."\n";
        $constructorBody .= '}';

        $setterBody = 'if (is_array($value)) {'."\n";
        $setterBody .= '    foreach ($value as $singleValue) {'."\n";
        $setterBody .= '        if (!$this->isValueValid($singleValue)) {'."\n";
        $setterBody .= '            throw new \\Exception(\'Unexpected value type\');'."\n";
        $setterBody .= '        }'."\n";
        $setterBody .= '    }'."\n";
        $setterBody .= '} elseif (!$this->isValueValid($value)) {'."\n";
        $setterBody .= '    throw new \\Exception(\'Unexpected value type\');'."\n";
        $setterBody .= '}'."\n";
        $setterBody .= '$this->value = $value;';

        $class
            ->setProperty(PhpProperty::create('value')
                ->setVisibility('private')
                ->setType('string')
            )
            ->setMethod(PhpMethod::create('__construct')
                ->setDescription('AbstractProperty constructor.')
                ->addParameter(PhpParameter::create('value')
                    ->setType('string')
                    ->setValue(null)
                )
                ->setBody($constructorBody)
            )
            ->setMethod(PhpMethod::create('setValue')
                ->setDescription('Set value.')
                ->addParameter(PhpParameter::create('value')
                    ->setType('string')
                )
                ->setType('AbstractProperty')
                ->setBody($setterBody."\n\n".'return $this;')
            )
            ->setMethod(PhpMethod::create('getValue')
                ->setDescription('Get value.')
                ->setType('string')
                ->setBody('return $this->value;')
            )
            ->setMethod(PhpMethod::create('isValueValid')
                ->setDescription('Check is value valid.')
                ->addParameter(PhpParameter::create('value')
                    ->setType('string')
                )
                ->setType('bool')
                ->setAbstract(true)
            )
            ->setMethod(PhpMethod::create('getSchemaUrl')
                ->setDescription('Get schema URL.')
                ->setType('string')
                ->setAbstract(true)
            )
        ;

        $generator = new CodeGenerator();
        $code = $generator->generate($class);

        file_put_contents($directory.'AbstractProperty.php', "<?php\n\n".$code);
    }