Returns de ClassDef for the related embedded document in a
    embedded document field.
978848
def get_field_embedded_doc(node):
    """"""

    definition = get_field_definition(node)
    cls_name = definition.last_child().last_child()
    cls = next(cls_name.infer())
    return cls
539365
def desc_for(self, obj: Element, doing_descs: bool) -> str:
        
        if obj.description and doing_descs:
            if isinstance(obj, SlotDefinition) and obj.is_a:
                parent = self.schema.slots[obj.is_a]
            elif isinstance(obj, ClassDefinition) and obj.is_a:
                parent = self.schema.classes[obj.is_a]
            else:
                parent = None
            return '' if parent and obj.description == parent.description else obj.description
        return ''
130864
def visit_field_class(self, item, descriptor=None, fields=None):
        """"""
        discovered_fields = collections.OrderedDict()
        field_groups = {}
        for node in item.body:
            if isinstance(node, ast.ClassDef):
                field_groups[node.name] = self.visit_field_class(node)
                continue

            if not isinstance(node, ast.Assign):
                continue
            if not isinstance(node.value, ast.Call):
                continue
            if not isinstance(node.targets[0], ast.Name):
                continue

            # Build accessible symbols table.
            symtable = {}
            # All field types.
            symtable.update({
                field.__name__: field
                for field in get_available_fields()
            })
            # Field group classes.
            symtable.update(field_groups)

            evaluator = SafeEvaluator(symtable=symtable)

            name = node.targets[0].id
            try:
                field = evaluator.run(node.value)
            except Exception as ex:
                # TODO: Handle errors.
                raise ex

            if descriptor is not None:
                field.contribute_to_class(descriptor, fields, name)
            else:
                discovered_fields[name] = field

        if descriptor is None:
            class Fields:
                """Fields wrapper."""

            for name, field in discovered_fields.items():
                setattr(Fields, name, field)

            return Fields
383565
int getFieldIndex(TypeElement declaringClass, String name, TypeMirror type)
    {
        return getFieldIndex(declaringClass, name, Descriptor.getFieldDesriptor(type));
    }
917081
public static Collection getEmbeddedCollectionInstance(Field embeddedCollectionField)
    {
        Collection embeddedCollection = null;
        Class embeddedCollectionFieldClass = embeddedCollectionField.getType();

        if (embeddedCollection == null || embeddedCollection.isEmpty())
        {
            if (embeddedCollectionFieldClass.equals(List.class))
            {
                embeddedCollection = new ArrayList<Object>();
            }
            else if (embeddedCollectionFieldClass.equals(Set.class))
            {
                embeddedCollection = new HashSet<Object>();
            }
            else
            {
                throw new InvalidEntityDefinitionException("Field " + embeddedCollectionField.getName()
                        + " must be either instance of List or Set");
            }
        }
        return embeddedCollection;
    }
785517
protected void parseTypeDefs(Document doc) {
    // Parse type definitions. Handy to match against defined AVP types
    // and to fill AVPs with generic function.
    // Format: <typedefn type-name="Integer32"  />
    //         <typedefn type-name="Enumerated" type-parent="Integer32" />
    NodeList typedefNodes = doc.getElementsByTagName("typedefn");

    for (int td = 0; td < typedefNodes.getLength(); td++) {
      Node typedefNode = typedefNodes.item(td);
      if (typedefNode.getNodeType() == Node.ELEMENT_NODE) {
        Element typedefElement = (Element) typedefNode;

        String typeName = typedefElement.getAttribute("type-name");
        String typeParent = typedefElement.getAttribute("type-parent");

        // UTF8String and Time are special situations, we don't want to convert these.
        if (typeParent == null || typeParent.equals("") || typeName.equals("UTF8String") || typeName.equals("Time")) {
          typeParent = typeName;
        }

        typedefMap.put(typeName, typeParent);
      }
    }
  }
1131527
private ClassDescriptor getClassDescriptor(int index) throws InvalidClassFileFormatException {
        @SlashedClassName
        String className = getClassName(index);
        return className != null ? DescriptorFactory.instance().getClassDescriptor(className) : null;
    }
729594
function amf0decTypedObj(buf) {
    var className = amf0decString(buf);
    var obj = amf0decObject(buf.slice(className.len - 1));
    obj.value.__className__ = className.value;
    return { len: className.len + obj.len - 1, value: obj.value }
}
78758
public void prepareEmbeddedId(TopDocs docs, Map<String, Object> indexCol, IndexSearcher searcher,
            EntityMetadata metadata, MetamodelImpl metaModel)
    {
        try
        {
            for (ScoreDoc sc : docs.scoreDocs)
            {
                Document doc = searcher.doc(sc.doc);
                Map<String, Object> embeddedIdFields = new HashMap<String, Object>();
                EmbeddableType embeddableId = metaModel.embeddable(metadata.getIdAttribute().getBindableJavaType());
                Set<Attribute> embeddedAttributes = embeddableId.getAttributes();

                prepareEmbeddedIdFields(embeddedAttributes, metaModel, embeddedIdFields, doc, metadata);

                String entityId = doc.get(IndexingConstants.ENTITY_ID_FIELD);
                indexCol.put(entityId, embeddedIdFields);
            }
        }
        catch (Exception e)
        {
            log.error("Error while parsing Lucene Query {} ", e);
            throw new LuceneIndexingException(e);
        }
    }
1272354
def get_declared_fields(mcs, klass, cls_fields, inherited_fields, dict_cls):
        
        opts = klass.opts
        converter = opts.model_converter(schema_cls=klass)
        base_fields = _BaseModelSerializerMetaclass.get_declared_fields(
            klass, cls_fields, inherited_fields, dict_cls)
        declared_fields = mcs.get_fields(converter, opts, base_fields, dict_cls)
        if declared_fields is not None:  # prevents sphinx from blowing up
            declared_fields.update(base_fields)
        return declared_fields
357957
function _classForDocument(doc) {
        switch (doc.getLanguage().getId()) {
        case "less":
        case "scss":
            return CSSPreprocessorDocument;
        case "css":
            return CSSDocument;
        case "javascript":
            return exports.config.experimental ? JSDocument : null;
        }

        if (LiveDevelopmentUtils.isHtmlFileExt(doc.file.fullPath)) {
            return HTMLDocument;
        }

        return null;
    }
23902
protected void indexCompositeKey(Set<Attribute> embeddedAttributes, EntityMetadata metadata, Object id,
        Document document, final MetamodelImpl metaModel) {
        // indexing individual fields of the composite key
        try {
            for (Attribute attribute : embeddedAttributes) {
                if (!ReflectUtils.isTransientOrStatic((java.lang.reflect.Field) attribute.getJavaMember())) {
                    if (metaModel.isEmbeddable(attribute.getJavaType())) {
                        EmbeddableType embeddable = metaModel.embeddable(attribute.getJavaType());
                        indexCompositeKey(embeddable.getAttributes(), metadata,
                            ((java.lang.reflect.Field) attribute.getJavaMember()).get(id), document, metaModel);
                    } else {
                        String columnName = ((AbstractAttribute) attribute).getJPAColumnName();
                        addFieldToDocument(id, document, (java.lang.reflect.Field) attribute.getJavaMember(),
                            columnName, metadata.getEntityClazz().getSimpleName());
                    }
                }
            }
        } catch (IllegalAccessException e) {
            LOG.error(e.getMessage());
        }
    }
1184907
@Override
	public ZooClassDef getSchema(Class<?> cls, Node node) {
		ZooClassDef ret = nodeSchemata.get(node).get(cls);
		if (ret == null) {
			if (cls == null) {
				return null;
			}
			//Try virtual/generic schemata
			ret = getSchema(cls.getName());
			if (ret != null) {
				//check (associate also checks compatibility)
				ret.associateJavaTypes(true);
				nodeSchemata.get(node).put(cls, ret);
			}
		}
		return ret;
	}
671353
def CLASSDEF(self, node):
        
        for deco in node.decorator_list:
            self.handleNode(deco, node)
        for baseNode in node.bases:
            self.handleNode(baseNode, node)
        if not PY2:
            for keywordNode in node.keywords:
                self.handleNode(keywordNode, node)
        self.push_scope(ClassScope)
        if self.settings.get('run_doctests', False):
            self.defer_function(lambda: self.handle_doctests(node))
        for stmt in node.body:
            self.handleNode(stmt, node)
        self.pop_scope()
        self.add_binding(node, ClassDefinition(node.name, node))
1327363
def gen_classdefs(self) -> str:
        
        return '\n'.join([self.gen_classdef(k, v) for k, v in self.schema.classes.items() if not v.mixin])
361218
private Collection<Candidate> findCandidateClasses(Outline outline, JClass xmlElementDeclModelClass) {
		Map<String, ClassOutline> interfaceImplementations = new HashMap<String, ClassOutline>();

		// Visit all classes to create a map "interfaceName -> ClassOutline".
		// This map is later used to resolve implementations from interfaces.
		for (ClassOutline classOutline : outline.getClasses()) {
			for (Iterator<JClass> iter = classOutline.implClass._implements(); iter.hasNext();) {
				JClass interfaceClass = iter.next();

				if (interfaceClass instanceof JDefinedClass) {
					// Don't care if some interfaces collide: value classes have exactly one implementation
					interfaceImplementations.put(interfaceClass.fullName(), classOutline);
				}
			}
		}

		Collection<Candidate> candidates = new ArrayList<Candidate>();

		JClass collectionModelClass = outline.getCodeModel().ref(Collection.class);
		JClass xmlSchemaModelClass = outline.getCodeModel().ref(XmlSchema.class);

		// Visit all classes created by JAXB processing to collect all potential wrapper classes to be removed:
		for (ClassOutline classOutline : outline.getClasses()) {
			JDefinedClass candidateClass = classOutline.implClass;

			// * The candidate class should not extend any other model class (as the total number of properties in this case will be more than 1)
			if (!isHiddenClass(candidateClass._extends())) {
				continue;
			}

			JFieldVar field = null;

			// * The candidate class should have exactly one property
			for (JFieldVar f : candidateClass.fields().values()) {
				if ((f.mods().getValue() & JMod.STATIC) == JMod.STATIC) {
					continue;
				}

				// If there are at least two non-static fields, we discard this candidate:
				if (field != null) {
					field = null;
					break;
				}

				field = f;
			}

			// "field" is null if there are no fields (or all fields are static) or there are more then two fields.
			// The only property should be a collection, hence it should be class:
			if (field == null || !(field.type() instanceof JClass)) {
				continue;
			}

			JClass fieldType = (JClass) field.type();

			// * The property should be a collection
			if (!collectionModelClass.isAssignableFrom(fieldType)) {
				continue;
			}

			List<JClass> fieldParametrisations = fieldType.getTypeParameters();

			// FIXME: All known collections have exactly one parametrisation type.
			assert fieldParametrisations.size() == 1;

			JDefinedClass fieldParametrisationClass = null;
			JDefinedClass fieldParametrisationImpl = null;

			// Parametrisations like "List<String>" or "List<Serialazable>" are not considered.
			// They are substituted as is and do not require moving of classes.
			if (fieldParametrisations.get(0) instanceof JDefinedClass) {
				fieldParametrisationClass = (JDefinedClass) fieldParametrisations.get(0);

				ClassOutline fieldParametrisationClassOutline = interfaceImplementations
				            .get(fieldParametrisationClass.fullName());

				if (fieldParametrisationClassOutline != null) {
					assert fieldParametrisationClassOutline.ref == fieldParametrisationClass;

					fieldParametrisationImpl = fieldParametrisationClassOutline.implClass;
				}
				else {
					fieldParametrisationImpl = fieldParametrisationClass;
				}
			}

			// We have a candidate class:
			Candidate candidate = new Candidate(candidateClass, classOutline.target, field, fieldParametrisationClass,
			            fieldParametrisationImpl, xmlElementDeclModelClass, xmlSchemaModelClass);
			candidates.add(candidate);

			logger.debug("Found " + candidate);
		}

		return candidates;
	}
936175
private void processEmbeddedField(Field field) {
    // We are creating a PropertyMetadata for the embedded field... The new
    // Mapper, EmbeddedObjectMapper, takes care of mapping embedded fields
    // to embedded entities.
    Embedded embeddedAnnotation = field.getAnnotation(Embedded.class);
    String name = embeddedAnnotation.name();
    if (name == null || name.trim().length() == 0) {
      name = field.getName();
    }
    boolean indexed = embeddedAnnotation.indexed();
    boolean optional = embeddedAnnotation.optional();
    PropertyMetadata propertyMetadata = new PropertyMetadata(field, name, indexed, optional);
    metadata.putPropertyMetadata(propertyMetadata);
  }