Populates @Id accesser methods like, getId and setId of clazz to
metadata.

@param metadata
the metadata
@param clazz
the clazz
@param f
the f
509330
protected final void populateIdAccessorMethods(EntityMetadata metadata, Class<?> clazz, Field f)
    {
        try
        {
            BeanInfo info = Introspector.getBeanInfo(clazz);

            for (PropertyDescriptor descriptor : info.getPropertyDescriptors())
            {
                if (descriptor.getName().equals(f.getName()))
                {
                    metadata.setReadIdentifierMethod(descriptor.getReadMethod());
                    metadata.setWriteIdentifierMethod(descriptor.getWriteMethod());
                    return;
                }
            }
        }
        catch (IntrospectionException e)
        {
            throw new RuntimeException(e);
        }
    }
216590
public EntityMetadata buildEntityMetadata(Class<?> clazz)
    {

        EntityMetadata metadata = new EntityMetadata(clazz);
      //  validate(clazz);

        if (log.isDebugEnabled())
            log.debug("Processing @Entity >> " + clazz);

        for (MetadataProcessor processor : metadataProcessors)
        {
            // // in case it is not intend for current persistence unit.
            // checkForRDBMS(metadata);
            // checkForNeo4J(metadata);

            setSchemaAndPU(clazz, metadata);

            processor.process(clazz, metadata);
            metadata = belongsToPersistenceUnit(metadata);
            if (metadata == null)
            {
                break;
            }

            // Check for schema attribute of Table annotation.
            if (MetadataUtils.isSchemaAttributeRequired(metadata.getPersistenceUnit(), kunderaMetadata)
                    && StringUtils.isBlank(metadata.getSchema()))
            {
                if (log.isErrorEnabled())
                {
                    log.error("It is mandatory to specify Schema alongwith Table name:" + metadata.getTableName()
                            + ". This entity won't be persisted");
                }
                throw new InvalidEntityDefinitionException("It is mandatory to specify Schema alongwith Table name:"
                        + metadata.getTableName() + ". This entity won't be persisted");
            }
        }

        return metadata;
    }
1089291
protected Object getId(Object entity, EntityMetadata metadata)
    {
        try
        {
            return PropertyAccessorHelper.getId(entity, metadata);
        }
        catch (PropertyAccessException e)
        {
            log.error("Error while Getting ID for entity {}, Caused by: {}.", entity, e);
            throw new EntityReaderException("Error while Getting ID for entity " + entity, e);
        }

    }
461646
private void visitMethod(Node member, ClassDeclarationMetadata metadata) {
    Node qualifiedMemberAccess = getQualifiedMemberAccess(member, metadata);
    Node method = member.getLastChild().detach();

    // Use the source info from the method (a FUNCTION) not the MEMBER_FUNCTION_DEF
    // because the MEMBER_FUNCTION_DEf source info only corresponds to the identifier
    Node assign =
        astFactory.createAssign(qualifiedMemberAccess, method).useSourceInfoIfMissingFrom(method);

    JSDocInfo info = member.getJSDocInfo();
    if (member.isStaticMember() && NodeUtil.referencesThis(assign.getLastChild())) {
      JSDocInfoBuilder memberDoc = JSDocInfoBuilder.maybeCopyFrom(info);
      memberDoc.recordThisType(
          new JSTypeExpression(new Node(Token.BANG, new Node(Token.QMARK)),
          member.getSourceFileName()));
      info = memberDoc.build();
    }
    if (info != null) {
      assign.setJSDocInfo(info);
    }

    Node newNode = NodeUtil.newExpr(assign);
    metadata.insertNodeAndAdvance(newNode);
  }
1323352
public function loadMetadataForClass($className, ClassMetadata $metadata)
    {
        $class = $metadata->getReflectionClass();
        if (! $class) {
            // this happens when running annotation driver in combination with
            // static reflection services. This is not the nicest fix
            $class = new \ReflectionClass($metadata->name);
        }

        $entityAnnot = $this->reader->getClassAnnotation($class, 'Doctrine\KeyValueStore\Mapping\Annotations\Entity');
        if (! $entityAnnot) {
            throw new \InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
        }
        $metadata->storageName = $entityAnnot->storageName;

        // Evaluate annotations on properties/fields
        foreach ($class->getProperties() as $property) {
            $idAnnot        = $this->reader->getPropertyAnnotation(
                $property,
                'Doctrine\KeyValueStore\Mapping\Annotations\Id'
            );
            $transientAnnot = $this->reader->getPropertyAnnotation(
                $property,
                'Doctrine\KeyValueStore\Mapping\Annotations\Transient'
            );
            if ($idAnnot) {
                $metadata->mapIdentifier($property->getName());
            } elseif ($transientAnnot) {
                $metadata->skipTransientField($property->getName());
            } else {
                $metadata->mapField(['fieldName' => $property->getName()]);
            }
        }
    }
161222
def populate_metadata(model, MetadataClass):
    
    content_type = ContentType.objects.get_for_model(model)
    for instance in model.objects.all():
        create_metadata_instance(MetadataClass, instance)
1212283
protected function loadInterfaceMetadata($metadata)
    {
        foreach( $metadata->getReflectionClass()->getInterfaces() as $interface ) {
            
            $metadata->mergeRules($this->getClassMetadata($interface->getName()));
            
        }
    }
975616
@VisibleForTesting
  protected void initMetadata(
      @Nullable String encoding, long sizeFromMetadata, @Nullable String generation)
      throws IOException {
    checkState(
        !metadataInitialized,
        "can not initialize metadata, it already initialized for '%s'", resourceIdString);
    gzipEncoded = nullToEmpty(encoding).contains(GZIP_ENCODING);
    if (gzipEncoded) {
      size = Long.MAX_VALUE;
    } else {
      size = sizeFromMetadata;
    }
    randomAccess = !gzipEncoded && readOptions.getFadvise() == Fadvise.RANDOM;
    checkEncodingAndAccess();

    initGeneration(generation);

    metadataInitialized = true;

    logger.atFine().log(
        "Initialized metadata (gzipEncoded=%s, size=%s, randomAccess=%s, generation=%s) for '%s'",
        gzipEncoded, size, randomAccess, generation, resourceIdString);
  }
1231877
private static void onBind(Class clazz)
    {

        if (((MetamodelImpl) em.getMetamodel()).getEntityMetadataMap().isEmpty())
        {

            EntityMetadata metadata = new EntityMetadata(clazz);
            metadata.setPersistenceUnit(getPersistenceUnit());

            setSchemaAndPU(clazz, metadata);

            new TableProcessor(em.getEntityManagerFactory().getProperties(),
                    ((EntityManagerFactoryImpl) em.getEntityManagerFactory()).getKunderaMetadataInstance())
                            .process(clazz, metadata);

            KunderaMetadata kunderaMetadata = ((EntityManagerFactoryImpl) em.getEntityManagerFactory())
                    .getKunderaMetadataInstance();

            new IndexProcessor(kunderaMetadata).process(clazz, metadata);

            ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata();

            ((MetamodelImpl) em.getMetamodel()).addEntityMetadata(clazz, metadata);
            ((MetamodelImpl) em.getMetamodel()).addEntityNameToClassMapping(clazz.getSimpleName(), clazz);
            appMetadata.getMetamodelMap().put(getPersistenceUnit(), em.getMetamodel());

            Map<String, List<String>> clazzToPuMap = new HashMap<String, List<String>>();
            List<String> persistenceUnits = new ArrayList<String>();
            persistenceUnits.add(getPersistenceUnit());
            clazzToPuMap.put(clazz.getName(), persistenceUnits);
            appMetadata.setClazzToPuMap(clazzToPuMap);
            new SchemaConfiguration(em.getEntityManagerFactory().getProperties(), kunderaMetadata, getPersistenceUnit())
                    .configure();

        }

    }
303201
private static void addInternal(String name, ObjectIdentifier oid,
            Class clazz) {
        OIDInfo info = new OIDInfo(name, oid, clazz);
        oidMap.put(oid, info);
        nameMap.put(name, info);
    }
318501
@Override
    public int getModelID(int accessor) throws JMFUninitializedAccessException, JMFSchemaViolationException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "getModelID", new Object[] { Integer.valueOf(accessor) });
        int ans;
        checkIndex(accessor);

        synchronized (getMessageLockArtefact()) {
            checkDynamic(accessor);

            if (cache[accessor] != null) {
                ans = ((JMFPart) cache[accessor]).getModelID();
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "getModelID", Integer.valueOf(ans));
                return ans;
            }

            if (contents == null) {
                JMFUninitializedAccessException e = new JMFUninitializedAccessException("Dynamic value at accessor " + accessor + " is missing");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    JmfTr.exit(this, tc, "getModelID", e);
                throw e;
            }

            // Get offset of the dynamic field
            int realOffset = getAbsoluteOffset(accessor);

            // Read model Id skipping over length
            ans = ArrayUtil.readInt(contents, realOffset + 4);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "getModelID", Integer.valueOf(ans));
        return ans;
    }
87711
private EntityMetadata getMetadata(Class<?> clazz)
    {
        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, clazz);
        if (metadata == null)
        {
            log.error("Entity metadata not found for {}, possible reasons may be: "
                    + "1) not annotated with @Entity. 2) is annotated with @MappedSuperclass."
                    + "3) does not properly with mapped persistence unit for persistence unit and keyspace. Please verify with @Table annotation or persistence.xml "
                    + clazz);
            throw new KunderaException("Entity metadata not found for " + clazz.getName());
        }
        return metadata;
    }
19930
public static ConceptId getInstance(String id, Metadata metadata) {
        List<Object> key = new ArrayList<>(1);
        key.add(id);
        ConceptId result = metadata.getFromConceptIdCache(key);
        if (result != null) {
            return result;
        } else {
            result = new SimpleConceptId(id, metadata);
            metadata.putInConceptIdCache(key, result);
            return result;
        }
    }
227267
public Operation setMetadata(Metadata metadata, OperationOption... options) {
    return compute.setMetadata(getInstanceId(), metadata, options);
  }
681715
public static ContextId fromMetaData(Map<String, String> metaData) {
        return new ContextId(metaData.get(META_KEY_ID));
    }
1059055
private void onFamilyType(EntityMetadata entityMetadata, final Class clazz, Field f)
    {
        if (entityMetadata.getType() == null || !entityMetadata.getType().equals(Type.SUPER_COLUMN_FAMILY))
        {
            if ((f.isAnnotationPresent(Embedded.class) && f.getType().getAnnotation(Embeddable.class) != null))
            {
                entityMetadata.setType(Type.SUPER_COLUMN_FAMILY);
            }
            else if (f.isAnnotationPresent(ElementCollection.class) && !MetadataUtils.isBasicElementCollectionField(f))
            {
                entityMetadata.setType(Type.SUPER_COLUMN_FAMILY);
            }
            else
            {
                entityMetadata.setType(Type.COLUMN_FAMILY);
            }
        }
    }
1316759
protected static function metaForId(ClassMetadataBuilder $builder): void
    {
        $builder->createField('id', MappingHelper::TYPE_UUID)
                ->makePrimaryKey()
                ->nullable(false)
                ->unique(true)
                ->generatedValue('NONE')
                ->build();
    }