Binds POJO to ODocument.
184520
@Override
  public ODocument toStream() {
    acquireExclusiveLock();
    try {
      document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING);

      try {
        final ORecordTrackedSet idxs = new ORecordTrackedSet(document);

        for (final OIndexInternal<?> i : indexes.values()) {
          idxs.add(i.updateConfiguration());
        }
        document.field(CONFIG_INDEXES, idxs, OType.EMBEDDEDSET);

      } finally {
        document.setInternalStatus(ORecordElement.STATUS.LOADED);
      }
      document.setDirty();

      return document;
    } finally {
      releaseExclusiveLock();
    }
  }
1213634
public void store(Document doc, Resource res) throws IOException {
	try {
	    XMLCaster.writeTo(doc, res);
	}
	catch (PageException e) {
	    throw ExceptionUtil.toIOException(e);
	}

	/*
	 * OutputFormat format = new OutputFormat(doc, null, true); format.setLineSeparator("\r\n");
	 * format.setLineWidth(72);
	 * 
	 * OutputStream os=null; try { XMLSerializer serializer = new
	 * XMLSerializer(os=res.getOutputStream(), format); serializer.serialize(doc.getDocumentElement());
	 * } finally { IOUtil.closeEL(os); }
	 */
    }
912509
public void bind() throws Throwable
   {
      if (name == null)
         throw new IllegalArgumentException("Name is null");

      if (obj == null)
         throw new IllegalArgumentException("Obj is null");

      if (trace)
         log.trace("Binding " + obj.getClass().getName() + " under " + name);

      Properties properties = new Properties();
      properties.setProperty(Context.PROVIDER_URL, jndiProtocol + "://" + jndiHost + ":" + jndiPort);
      Context context = new InitialContext(properties);

      try
      {
         String className = obj.getClass().getName();
         Reference ref = new Reference(className,
                                       new StringRefAddr("class", className),
                                       JndiBinder.class.getName(),
                                       null);
         ref.add(new StringRefAddr("name", name));

         objs.put(name, obj);

         Util.bind(context, name, ref);

         if (log.isDebugEnabled())
            log.debug("Bound " + obj.getClass().getName() + " under " + name);
      }
      finally
      {
         if (context != null)
         {
            try
            {
               context.close();
            }
            catch (NamingException ne)
            {
               // Ignore
            }
         }
      }
   }
416952
def bind_fields_to_model_cls(cls, model_fields):
        """"""
        return dict(
            (field.name, field.bind_model_cls(cls)) for field in model_fields)
496892
def process_bind_param(self, value, dialect):
        """"""
        if value is not None:
            value = simplejson.dumps(value)
        return value
981748
@Override
    @SuppressWarnings("unchecked")
    public synchronized <P> PojoBinding<P> createPojoBinding(Class<P> pojoType) {
        DefaultPojoBinding<P> binding = (DefaultPojoBinding<P>) bindingMap.get(pojoType);
        if (binding == null) {
            binding = new DefaultPojoBinding<>(pojoType);
            bindingMap.put(pojoType, binding);
            List<Facet> keyFacets = injectFacetBindings(binding, pojoType);
            injectKeyBinding(binding, pojoType, keyFacets);
        }
        return binding;
    }
1079204
protected BindingResult<T> doConvert(Object value, ArgumentConversionContext<T> context) {
        Optional<T> result = conversionService.convert(value, context);
        if (result.isPresent() && context.getArgument().getType() == Optional.class) {
            return () -> (Optional<T>) result.get();
        }
        return () -> result;
    }
484815
def _bind(self, _descriptor):
        

        # If the method has a default code, use it
        self._defcode = getattr(_descriptor.method, '_wsgi_code', 200)

        # Set up content type and serializer
        self.content_type, self.serializer = _descriptor.serializer(self.req)
452081
private void addBinding(Binding<?, ?, V> binding)
	{
		bindings.add(binding);
		
		// prevent infinite loop when binder bound by itself
		if (binding.getSource() != this)
		{
			updateViolations();
			
			// TODO: aggregate violations better; ideally provide a live view
			binding.addObservableListener(new ObservableListener<Collection<V>>()
			{
				public void valueChanged(ObservableEvent<Collection<V>> event)
				{
					updateViolations();
				}
			});
		}
	}
300426
def bind(self):
        """"""
        self.endline <<= attach(self.endline_ref, self.endline_handle)

        self.moduledoc_item <<= trace(attach(self.moduledoc, self.set_docstring))
        self.name <<= trace(attach(self.base_name, self.name_check))
        # comments are evaluated greedily because we need to know about them even if we're going to suppress them
        self.comment <<= trace(attach(self.comment_ref, self.comment_handle, greedy=True))
        self.set_literal <<= trace(attach(self.set_literal_ref, self.set_literal_handle))
        self.set_letter_literal <<= trace(attach(self.set_letter_literal_ref, self.set_letter_literal_handle))
        self.classlist <<= trace(attach(self.classlist_ref, self.classlist_handle))
        self.import_stmt <<= trace(attach(self.import_stmt_ref, self.import_handle))
        self.complex_raise_stmt <<= trace(attach(self.complex_raise_stmt_ref, self.complex_raise_stmt_handle))
        self.augassign_stmt <<= trace(attach(self.augassign_stmt_ref, self.augassign_handle))
        self.dict_comp <<= trace(attach(self.dict_comp_ref, self.dict_comp_handle))
        self.destructuring_stmt <<= trace(attach(self.destructuring_stmt_ref, self.destructuring_stmt_handle))
        self.name_match_funcdef <<= trace(attach(self.name_match_funcdef_ref, self.name_match_funcdef_handle))
        self.op_match_funcdef <<= trace(attach(self.op_match_funcdef_ref, self.op_match_funcdef_handle))
        self.yield_from <<= trace(attach(self.yield_from_ref, self.yield_from_handle))
        self.exec_stmt <<= trace(attach(self.exec_stmt_ref, self.exec_stmt_handle))
        self.stmt_lambdef <<= trace(attach(self.stmt_lambdef_ref, self.stmt_lambdef_handle))
        self.typedef <<= trace(attach(self.typedef_ref, self.typedef_handle))
        self.typedef_default <<= trace(attach(self.typedef_default_ref, self.typedef_handle))
        self.unsafe_typedef_default <<= trace(attach(self.unsafe_typedef_default_ref, self.unsafe_typedef_handle))
        self.return_typedef <<= trace(attach(self.return_typedef_ref, self.typedef_handle))
        self.typed_assign_stmt <<= trace(attach(self.typed_assign_stmt_ref, self.typed_assign_stmt_handle))
        self.datadef <<= trace(attach(self.datadef_ref, self.data_handle))
        self.with_stmt <<= trace(attach(self.with_stmt_ref, self.with_stmt_handle))
        self.await_item <<= trace(attach(self.await_item_ref, self.await_item_handle))
        self.ellipsis <<= trace(attach(self.ellipsis_ref, self.ellipsis_handle))
        self.case_stmt <<= trace(attach(self.case_stmt_ref, self.case_stmt_handle))

        self.decoratable_normal_funcdef_stmt <<= trace(attach(
            self.decoratable_normal_funcdef_stmt_ref,
            self.decoratable_funcdef_stmt_handle,
        ))
        self.decoratable_async_funcdef_stmt <<= trace(attach(
            self.decoratable_async_funcdef_stmt_ref,
            partial(self.decoratable_funcdef_stmt_handle, is_async=True),
        ))

        self.u_string <<= attach(self.u_string_ref, self.u_string_check)
        self.matrix_at <<= attach(self.matrix_at_ref, self.matrix_at_check)
        self.nonlocal_stmt <<= attach(self.nonlocal_stmt_ref, self.nonlocal_check)
        self.star_assign_item <<= attach(self.star_assign_item_ref, self.star_assign_item_check)
        self.classic_lambdef <<= attach(self.classic_lambdef_ref, self.lambdef_check)
        self.star_expr <<= attach(self.star_expr_ref, self.star_expr_check)
        self.dubstar_expr <<= attach(self.dubstar_expr_ref, self.star_expr_check)
        self.star_sep_arg <<= attach(self.star_sep_arg_ref, self.star_sep_check)
        self.star_sep_vararg <<= attach(self.star_sep_vararg_ref, self.star_sep_check)
        self.endline_semicolon <<= attach(self.endline_semicolon_ref, self.endline_semicolon_check)
        self.async_stmt <<= attach(self.async_stmt_ref, self.async_stmt_check)
        self.async_comp_for <<= attach(self.async_comp_for_ref, self.async_comp_check)
        self.f_string <<= attach(self.f_string_ref, self.f_string_check)
1112660
def default(self, obj):
        """"""
        if isinstance(obj, BioCDocument):
            return encode_document(obj)
        if isinstance(obj, BioCCollection):
            return encode_collection(obj)
        raise TypeError(f'Object of type {obj.__class__.__name__} is not BioC XML serializable')
341789
private void collectBindings(List<SitebricksModule.LinkingBinder> bindings,
                               Set<PageBook.Page> pagesToCompile) {

    // Reverse the method map for easy lookup of HTTP method annotations.
    Map<Class<? extends Annotation>, String> methodSet = null;

    //go thru bindings and obtain pages from them.
    for (SitebricksModule.LinkingBinder binding : bindings) {

      if (EMBEDDED == binding.bindingKind) {
        if (null == binding.embedAs) {
          // This can happen if embed() is not followed by an .as(..)
          throw new IllegalStateException("embed() missing .as() clause: " + binding.pageClass);
        }
        registry.addEmbed(binding.embedAs);
        pagesToCompile.add(pageBook.embedAs(binding.pageClass, binding.embedAs));

      } else if (PAGE == binding.bindingKind) {
        pagesToCompile.add(pageBook.at(binding.uri, binding.pageClass));

      } else if (STATIC_RESOURCE == binding.bindingKind) {
        //localize the resource to the SitebricksModule's package.
        resourcesService.add(SitebricksModule.class, binding.getResource());
      } else if (SERVICE == binding.bindingKind) {
        pagesToCompile.add(pageBook.serviceAt(binding.uri, binding.pageClass));
      } else if (ACTION == binding.bindingKind) {
        // Lazy create this inverse lookup map, once.
        if (null == methodSet) {
          methodSet = HashBiMap.create(methodMap).inverse();
        }
        pageBook.at(binding.uri, binding.actionDescriptors, methodSet);
      }
    }
  }
542853
public static synchronized void bind(String propertiesPath, Class clazz) throws BindingException
    {
        if (em == null)
        {
            em = PersistenceService.getEM(emf, propertiesPath, clazz.getName());
        }
        onBind(clazz);
    }
462519
private void bindAttribute(Annotation annotation)
    {
        String fieldname = ((AttributeOverride) annotation).name();
        Column column = ((AttributeOverride) annotation).column();
        ((AbstractManagedType) this.superClazzType).columnBindings.put(fieldname, column);
    }
261645
public Document serialiseToDocument(final Object obj)
	{
		final Document document = DOMUtils.createDocumentBuilder().newDocument();

		serialise(obj, document);

		return document;
	}
14001
private void processLinks(JsonParser jsonParser) throws IOException {

        LOG.info("@odata.bind tag found - start parsing");

        final String fullLinkFieldName = jsonParser.getText();
        final String key = fullLinkFieldName.substring(0, fullLinkFieldName.indexOf(ODATA_BIND));
        JsonToken token = jsonParser.nextToken();
        if (token != JsonToken.START_ARRAY) {
            // Single link
            links.put(key, processLink(jsonParser));
        } else {
            // Array of links
            final List<String> linksList = new ArrayList<>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                linksList.add(processLink(jsonParser));
            }
            this.links.put(key, linksList);

        }
    }
624842
private static void attachJSDocInfoToNominalTypeOrShape(
      ObjectType objType, JSDocInfo docInfo, @Nullable String qName) {

    if (objType.isConstructor() || objType.isInterface()) {
      if (!isReferenceNameOf(objType, qName)) {
        return;
      }

      objType.setJSDocInfo(docInfo);
      JSType.toMaybeFunctionType(objType).getInstanceType().setJSDocInfo(docInfo);
    } else if (objType.isEnumType()) {
      // Given: `/** @enum {number} */ MyEnum = { FOO: 0 };`
      // Then: typeOf(MyEnum).referenceName() == "enum{MyEnum}"
      // Then: typeOf(MyEnum.FOO).referenceName() == "MyEnum"
      ObjectType elementType = objType.toMaybeEnumType().getElementsType();
      if (!isReferenceNameOf(elementType, qName)) {
        return;
      }

      objType.setJSDocInfo(docInfo);
      elementType.setJSDocInfo(docInfo);
    } else if (!objType.isNativeObjectType() && objType.isFunctionType()) {
      // Anonymous function types identified by their parameter and return types. Remember there can
      // be many unique but equal instances.
      objType.setJSDocInfo(docInfo);
    }
  }