Unmarshals the embedded field represented by the given embedded metadata.

@param embeddedMetadata
the embedded metadata
@param target
the target object that needs to be updated
@throws Throwable
propagated
322263
private void unmarshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target)
      throws Throwable {
    Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
    for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
      unmarshalProperty(propertyMetadata, embeddedObject);
    }
    for (EmbeddedMetadata embeddedMetadata2 : embeddedMetadata.getEmbeddedMetadataCollection()) {
      unmarshalWithExplodedStrategy(embeddedMetadata2, embeddedObject);
    }
    ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
    if (constructorMetadata.isBuilderConstructionStrategy()) {
      embeddedObject = constructorMetadata.getBuildMethodHandle().invoke(embeddedObject);
    }
    embeddedMetadata.getWriteMethod().invoke(target, embeddedObject);
  }
608497
@Internal
    public static void contributeDefaults(AnnotationMetadata target, AnnotationMetadata source) {
        if (target instanceof DefaultAnnotationMetadata && source instanceof DefaultAnnotationMetadata) {
            final Map<String, Map<CharSequence, Object>> existingDefaults = ((DefaultAnnotationMetadata) target).annotationDefaultValues;
            if (existingDefaults != null) {
                final Map<String, Map<CharSequence, Object>> additionalDefaults = ((DefaultAnnotationMetadata) source).annotationDefaultValues;
                if (additionalDefaults != null) {
                    existingDefaults.putAll(
                            additionalDefaults
                    );
                }
            }
        }
    }
568397
public <T> void setUsermetaData(RiakUserMetadata userMetadata, T obj)
    {
        Field mapField = null;
        for (UsermetaField uf : usermetaFields)
        {
            switch (uf.getFieldType())
            {
                case STRING:
                    if (userMetadata.containsKey(uf.getUsermetaDataKey()))
                    {
                        setFieldValue(uf.getField(), obj, userMetadata.get(uf.getUsermetaDataKey()));
                        userMetadata.remove(uf.getUsermetaDataKey());
                    }
                    break;
                case MAP:
                    mapField = uf.getField();
                    break;
                default:
                    break;
            }
        }

        Method mapSetter = null;
        for (UsermetaMethod um : usermetaMethods)
        {
            switch (um.getMethodType())
            {
                case STRING_SETTER:
                    if (userMetadata.containsKey(um.getUsermetaDataKey()))
                    {
                        setMethodValue(um.getMethod(), obj, userMetadata.get(um.getUsermetaDataKey()));
                        userMetadata.remove(um.getUsermetaDataKey());
                    }
                    break;
                case MAP_SETTER:
                    mapSetter = um.getMethod();
                    break;
                default:
                    break;
            }
        }

        if (mapSetter != null || mapField != null)
        {
            Map<String,String> mapCopy = new HashMap<>(userMetadata.size());
            for (Map.Entry<BinaryValue,BinaryValue> entry : userMetadata.getUserMetadata())
            {
                mapCopy.put(entry.getKey().toString(), entry.getValue().toString());
            }

            if (mapSetter != null)
            {
                setMethodValue(mapSetter, obj, mapCopy);
            }

            if (mapField != null)
            {
                setFieldValue(mapField, obj, mapCopy);
            }
        }
    }
519566
@VisibleForTesting
  static Map<String, String> encodeMetadata(Map<String, byte[]> metadata) {
    return Maps.transformValues(metadata, ENCODE_METADATA_VALUES);
  }
892383
private void processEmbeddedField(Field field) {
    // First create EmbeddedField so we can maintain the path/depth of the
    // embedded field
    EmbeddedField embeddedField = new EmbeddedField(field);
    // Introspect the embedded field.
    EmbeddedMetadata embeddedMetadata = EmbeddedIntrospector.introspect(embeddedField,
        entityMetadata);
    entityMetadata.putEmbeddedMetadata(embeddedMetadata);
  }
759645
public Object get(Object target) throws MetadataException
    {
        Object result = target;
        if (isNestedField())
        {
            List fields = getFieldsList();
            for (int i = 0; i < fields.size(); i++)
            {
                if (result == null) break;
                result = getValueFrom((Field) fields.get(i), result);
            }
        }
        else
        {
            result = result != null ? getValueFrom(getField(), result) : null;
        }
        return result;
    }
75655
public void clearMetaData(Object key) {        if (key == this.key) {
            key = null;
            wmmd = null;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "MetaData was removed.");
            }
        } else {
        }
    }
668529
private static void onViaEmbeddable(EntityType entityType, Attribute column, EntityMetadata m, Object entity,
            EmbeddableType embeddable, JsonObject jsonObj)
    {
        Field embeddedField = (Field) column.getJavaMember();
        JsonElement embeddedDocumentObject = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
        if (!column.isCollection())
        {
            PropertyAccessorHelper.set(
                    entity,
                    embeddedField,
                    getObjectFromJson(embeddedDocumentObject.getAsJsonObject(),
                            ((AbstractAttribute) column).getBindableJavaType(), embeddable.getAttributes()));
        }
    }
954465
public void setIdentifierMetadata(IdentifierMetadata identifierMetadata) {
    if (this.identifierMetadata != null) {
      String format = "Class %s has at least two fields, %s and %s, marked with %s annotation. "
          + "Only one field can be marked as an identifier. ";
      String message = String.format(format, entityClass.getName(),
          this.identifierMetadata.getName(), identifierMetadata.getName(),
          Identifier.class.getName());
      throw new EntityManagerException(message);
    }
    this.identifierMetadata = identifierMetadata;
  }
74220
private void buildEmbeddedValue(final Object record, MetamodelImpl metaModel, StringBuilder embeddedValueBuilder,
            SingularAttribute attribute)
    {
        // TODO Auto-generated method stub
        Field field = (Field) attribute.getJavaMember();

        EmbeddableType embeddableKey = metaModel.embeddable(field.getType());
        Object embeddableKeyObj = PropertyAccessorHelper.getObject(record, field);
        if (embeddableKeyObj != null)
        {
            StringBuilder tempBuilder = new StringBuilder();
            tempBuilder.append(Constants.OPEN_CURLY_BRACKET);

            for (Field embeddableColumn : field.getType().getDeclaredFields())
            {
                if (!ReflectUtils.isTransientOrStatic(embeddableColumn))
                {
                    Attribute subAttribute = (SingularAttribute) embeddableKey.getAttribute(embeddableColumn.getName());
                    if (metaModel.isEmbeddable(((AbstractAttribute) subAttribute).getBindableJavaType()))
                    {
                        // construct map; recursive
                        // send attribute
                        buildEmbeddedValue(embeddableKeyObj, metaModel, tempBuilder, (SingularAttribute) subAttribute);
                    }
                    else
                    {
                        // append key value
                        appendColumnName(tempBuilder, ((AbstractAttribute) (embeddableKey.getAttribute(embeddableColumn
                                .getName()))).getJPAColumnName());
                        tempBuilder.append(Constants.COLON);
                        appendColumnValue(tempBuilder, embeddableKeyObj, embeddableColumn);
                    }
                    tempBuilder.append(Constants.COMMA);
                }

            }
            // strip last char and append '}'
            tempBuilder.deleteCharAt(tempBuilder.length() - 1);
            tempBuilder.append(Constants.CLOSE_CURLY_BRACKET);
            appendColumnName(embeddedValueBuilder, ((AbstractAttribute) attribute).getJPAColumnName());
            embeddedValueBuilder.append(Constants.COLON);
            embeddedValueBuilder.append(tempBuilder);
        }
        else
        {
            embeddedValueBuilder.deleteCharAt(embeddedValueBuilder.length() - 1);
        }
    }
303685
@Override
    public BufferByteOutput<T> target(final T target) {
        return (BufferByteOutput<T>) super.target(target);
    }
893243
private void processEmbeddedField(Field child) {
    EmbeddedField embeddedChild = new EmbeddedField(child, field);
    EmbeddedMetadata childMetadata = EmbeddedIntrospector.introspect(embeddedChild, entityMetadata);
    metadata.putEmbeddedMetadata(childMetadata);
  }
563973
private void unmarshalIdentifier() throws Throwable {
    IdentifierMetadata identifierMetadata = entityMetadata.getIdentifierMetadata();
    Object id = ((Key) nativeEntity.getKey()).getNameOrId();
    // If the ID is not a simple type...
    IdClassMetadata idClassMetadata = identifierMetadata.getIdClassMetadata();
    if (idClassMetadata != null) {
      Object wrappedId = idClassMetadata.getConstructor().invoke(id);
      id = wrappedId;
    }
    // Now set the ID (either simple or complex) on the Entity
    MethodHandle writeMethod = identifierMetadata.getWriteMethod();
    writeMethod.invoke(entity, id);
  }
585071
public void setTelemetryMetadata(java.util.Collection<TelemetryMetadata> telemetryMetadata) {
        if (telemetryMetadata == null) {
            this.telemetryMetadata = null;
            return;
        }

        this.telemetryMetadata = new java.util.ArrayList<TelemetryMetadata>(telemetryMetadata);
    }
1161042
@SuppressWarnings({ "rawtypes", "unchecked" })
	private void setAttribute(NodeConfig nodeConfig, Object targetObject) throws UnmarshalException {
		Class targetClass = targetObject.getClass();
		List attributes = nodeConfig.getAttribute();
		if (attributes != null && attributes.size() > 0) {
			for (Iterator iterAttr = attributes.iterator(); iterAttr.hasNext();) {
				AttributeConfig attribute = (AttributeConfig) iterAttr.next();
				String methodName = Constant.SET_PREFIX + StringUtils.capitalize(attribute.getName());
				try {
					Method method = targetClass.getMethod(methodName, String.class);
					if (method != null) {
						setMethod(method, targetObject, attribute.getValue());
					}
				} catch (NoSuchMethodException e) {
					if (validation) {
						throw new UnmarshalException(e);
					}
				}
			}
		}
	}
1120640
public void populateMetadata(final Target target) {
        removeAllItems();
        if (target == null) {
            return;
        }
        selectedTargetId = target.getId();
        final List<TargetMetadata> targetMetadataList = targetManagement
                .findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
                .getContent();
        if (targetMetadataList != null && !targetMetadataList.isEmpty()) {
            targetMetadataList.forEach(this::setMetadataProperties);
        }
    }
1127148
public void setEditorTarget (PropertyEditorTarget target)
    {
        if (target instanceof DBMetaSchemaNode)
        {
            super.setEditorTarget(target);
            this.tfSchemaName.setText((String)target.getAttribute(DBMetaSchemaNode.ATT_SCHEMA_NAME));
        }
        else
        {
            throw new UnsupportedOperationException("This editor can only edit DBSchemaCatalogNode objects");
        }
    }