<p>Build a <b>CRest</b> instance.</p>
<p><b>CRest</b> is an expensive object to create and should be created once at the application bootstrap and re-used. <b>CRest</b> instances are threadsafe.</p>
@return a <b>CRest</b> instance
779054
public CRest build() {
        putIfAbsentAndNotNull(crestProperties, DefaultResponseHandler.MIN_ERROR_STATUS_CODE_PROP, MIN_ERROR_STATUS_CODE);
        putIfAbsentAndNotNull(crestProperties, CRestConfig.class.getName() + "#placeholders", compile(placeholders));
        CRestConfig crestConfig = new DefaultCRestConfig(crestProperties);

        ComponentRegistry<String,Deserializer> mimeDeserializerRegistry = buildDeserializerRegistry(crestConfig);
        ComponentRegistry<Class<?>,Deserializer> classDeserializerRegistry = classDeserializerBuilder.build(crestConfig);

        ComponentRegistry<Class<?>,Serializer> classSerializerRegistry = classSerializerBuilder.build(crestConfig);
        InterfaceConfigBuilderFactory icbf = new DefaultInterfaceConfigBuilderFactory(crestConfig, mimeDeserializerRegistry, classSerializerRegistry);
        ParamConfigBuilderFactory pcbf = new DefaultParamConfigBuilderFactory(crestConfig, classSerializerRegistry);
        putIfAbsentAndNotNull(crestProperties, ParamConfigBuilderFactory.class.getName(), pcbf);

        ProxyFactory pProxyFactory = getInstance(this.proxyFactory, this.proxyFactoryClass, crestConfig);
        HttpChannelFactory plainChannelFactory = getInstance(this.httpChannelFactory, this.httpChannelFactoryClass, crestConfig);

        Authorization authorization = buildAuthorization(plainChannelFactory);
        putIfAbsentAndNotNull(crestProperties, Authorization.class.getName(), authorization);

        ResponseDeserializer mimeResponseDeserializer = new ResponseDeserializerByMimeType(mimeDeserializerRegistry);
        ResponseDeserializer classResponseDeserializer = new ResponseDeserializerByClass(classDeserializerRegistry);
        ResponseDeserializer deserializersResponseDeserializer = new ResponseDeserializerByDeserializers();

        ResponseDeserializer baseResponseDeserializer = new ResponseDeserializerComposite(deserializersResponseDeserializer, mimeResponseDeserializer, classResponseDeserializer);
        ResponseDeserializer customTypeResponseDeserializer = new ResponseDeserializerComposite(classResponseDeserializer, mimeResponseDeserializer);

        RequestExecutor requestExecutor = buildRequestExecutor(plainChannelFactory, authorization, baseResponseDeserializer, customTypeResponseDeserializer);



        if(JaxRsAnnotations.isJaxRsAware()) {
            this.annotationHandlerBuilder.register(JaxRsAnnotations.getMapping());
        }

        InterfaceConfigFactory configFactory = new AnnotationDrivenInterfaceConfigFactory(icbf, annotationHandlerBuilder.build(crestConfig));

        return new DefaultCRest(pProxyFactory, requestExecutor, requestBuilderFactory, configFactory);
    }
167883
@Override
    public T build() {
        return build(new ProxyCreatedCallback<T>() {

            @Override
            public void onProxyCreationFinished(T result) {
                logger.trace("proxy created: interface: {} domains: {}", interfaceName, domains);
            }

            @Override
            public void onProxyCreationError(JoynrRuntimeException error) {
                logger.error("error creating proxy: interface: {} domains: {}, error: {}",
                             interfaceName,
                             domains,
                             error.getMessage());
            }
        });
    }
212984
public function build(): RequestNodeRequest
	{
		$instance = new RequestNodeRequest();
		if ($this->objectId === null) {
			throw new BuilderException('Property [objectId] is required.');
		}
		$instance->objectId = $this->objectId;
		return $instance;
	}
1271134
public static DomUtil getInstance() {

    if (instance == null) {
      synchronized (DomUtilImpl.class) {
        if (instance == null) {
          DomUtilImpl util = new DomUtilImpl();
          util.initialize();
          instance = util;
        }
      }
    }
    return instance;
  }
107644
public static Sham getInstance() {
        if(Sham.instance == null) {
            Sham.instance = new Sham();
        }
        return Sham.instance;
    }
1156413
public function build(): RemoveDOMBreakpointRequest
	{
		$instance = new RemoveDOMBreakpointRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		if ($this->type === null) {
			throw new BuilderException('Property [type] is required.');
		}
		$instance->type = $this->type;
		return $instance;
	}
643230
public AnnotationType<ElementType<T>> getOrCreateAnnotation()
   {
      List<Node> nodeList = childNode.get("annotation");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new AnnotationTypeImpl<ElementType<T>>(this, "annotation", childNode, nodeList.get(0));
      }
      return createAnnotation();
   }
505355
public Counter build()
	{
		return new Counter(this.getName(), this.getDescription(), this.getNumShards(),
			this.getCounterStatus(), this.getCount(), this.getIndexes(), this.getCreationDateTime());
	}
516775
public function build(): SetBreakpointsActiveRequest
	{
		$instance = new SetBreakpointsActiveRequest();
		if ($this->active === null) {
			throw new BuilderException('Property [active] is required.');
		}
		$instance->active = $this->active;
		return $instance;
	}
357276
public Tree<T> build() {
        Tree<T> result = base;
        if (null == base && treeStack.size() == 1) {
            result = treeStack.get(0);
        } else if (treeStack.size() > 0) {
            result = new TreeStack<T>(treeStack, base);
        }else if(null==base) {
            throw new IllegalArgumentException("base tree was not set");
        }

        return result;
    }
885402
public static<T> ServiceInstanceBuilder<T>builder() throws Exception
    {
        String                  address = null;
        Collection<InetAddress> ips = ServiceInstanceBuilder.getAllLocalIPs();
        if ( ips.size() > 0 )
        {
            address = ips.iterator().next().getHostAddress();   // default to the first address
        }

        String                  id = UUID.randomUUID().toString();

        return new ServiceInstanceBuilder<T>().address(address).id(id).registrationTimeUTC(System.currentTimeMillis());
    }
147307
public SpannableStringBuilder build() {
        if (mBeforeStringBuilder.length() > 0) {
            mStringBuilder.insert(0, mBeforeStringBuilder);

            // reset SpecialUnit start pos
            if (!mFinalSpecialUnit.isEmpty()) {
                for (BaseSpecialUnit specialUnit : mFinalSpecialUnit) {
                    int[] tempStartPoss = specialUnit.getStartPoss();

                    if (null == tempStartPoss || tempStartPoss.length == 0) continue;

                    for (int i = 0; i < tempStartPoss.length; i++) {
                        int oldStartPos = tempStartPoss[i];
                        tempStartPoss[i] = oldStartPos + mBeforeStringBuilder.length();
                    }
                }
            }

            // reset Cache SpecialClickableUnit start pos
            if (!mCacheSpecialClickableUnitMap.isEmpty()) {
                for (Map.Entry<SpecialClickableUnit, PositionInfo> cm : mCacheSpecialClickableUnitMap.entrySet()) {
                    cm.getValue().startPos += mBeforeStringBuilder.length();
                }
            }
        }

        if (!mBeforeCacheSpecialClickableUnitMap.isEmpty()) {
            mCacheSpecialClickableUnitMap.putAll(mBeforeCacheSpecialClickableUnitMap);
        }

        if (!mBeforeSpecialUnit.isEmpty()) {
            mFinalSpecialUnit.addAll(mBeforeSpecialUnit);
        }

        if (mStringBuilder.length() == 0) return null;
        if (mFinalSpecialUnit.isEmpty())
            return new SpannableStringBuilder(mStringBuilder.toString());

        if (mNormalSizeText.length() == 0) mNormalSizeText.append(mStringBuilder);

        String normalSizeText = mNormalSizeText.toString();
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(mStringBuilder);
        boolean isInitClickListener = false;
        for (BaseSpecialUnit st : mFinalSpecialUnit) {
            String specialText = st.getText();
            int[] startPoss = st.getStartPoss();

            if (TextUtils.isEmpty(specialText) || null == startPoss || startPoss.length == 0)
                continue;

            int specialTextLength = specialText.length();
            if (st instanceof SpecialTextUnit) {
                // text span
                SpecialTextUnit specialTextUnit = (SpecialTextUnit) st;

                final SpecialClickableUnit internalSpecialClickableUnit = specialTextUnit.getSpecialClickableUnit();
                if (null != internalSpecialClickableUnit) {
                    if (internalSpecialClickableUnit.getNormalTextColor() == 0) {
                        internalSpecialClickableUnit.setNormalTextColor(specialTextUnit.getTextColor());
                    }
                    if (internalSpecialClickableUnit.getNormalBgColor() == 0) {
                        internalSpecialClickableUnit.setNormalBgColor(specialTextUnit.getTextBackgroundColor());
                    }
                }
                for (int startPos : startPoss) {
                    // Set Text Color
                    if (specialTextUnit.getTextColor() != 0) {
                        spannableStringBuilder.setSpan(new ForegroundColorSpan(specialTextUnit.getTextColor()), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Set Text Background Color
                    if (specialTextUnit.getTextBackgroundColor() != 0 && null == internalSpecialClickableUnit) {
                        spannableStringBuilder.setSpan(new BackgroundColorSpan(specialTextUnit.getTextBackgroundColor()), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Add Underline
                    if (specialTextUnit.isShowUnderline()) {
                        spannableStringBuilder.setSpan(new UnderlineSpan(), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Add StrikeThrough
                    if (specialTextUnit.isShowStrikeThrough()) {
                        spannableStringBuilder.setSpan(new StrikethroughSpan(), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Set Text Bold
                    if (specialTextUnit.isTextBold()) {
                        spannableStringBuilder.setSpan(new StyleSpan(Typeface.BOLD), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Set Text Italic
                    if (specialTextUnit.isTextItalic()) {
                        spannableStringBuilder.setSpan(new StyleSpan(Typeface.ITALIC), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Set Text Style
                    if (specialTextUnit.getTextStyle() != Typeface.NORMAL) {
                        spannableStringBuilder.setSpan(new StyleSpan(specialTextUnit.getTextStyle()), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }

                    // Set Text Size
                    if (specialTextUnit.getTextSize() > 0) {
                        TextView curTextView = specialTextUnit.getCurTextView();
                        int gravity = specialTextUnit.getGravity();
                        if (gravity != SpecialGravity.BOTTOM && null != curTextView) {
                            spannableStringBuilder.setSpan(new CustomAbsoluteSizeSpan(normalSizeText, specialTextUnit.getText(), Math.round(specialTextUnit.getTextSize()), curTextView, gravity), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                        } else {
                            spannableStringBuilder.setSpan(new AbsoluteSizeSpan(Math.round(specialTextUnit.getTextSize()), true), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                        }
                    }

                    // set clickable
                    if (null != internalSpecialClickableUnit) {
                        if (!isInitClickListener) {
                            isInitClickListener = true;
                            TextView curTextView = internalSpecialClickableUnit.getCurTextView();
                            if (null != curTextView) {
                                curTextView.setMovementMethod(CustomLinkMovementMethod.getInstance());
                            }
                        }
                        spannableStringBuilder.setSpan(new CustomClickableSpan(internalSpecialClickableUnit), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                    }
                }
            } else if (st instanceof SpecialImageUnit) {
                // image Span
                SpecialImageUnit specialImageUnit = (SpecialImageUnit) st;
                Bitmap bitmap = specialImageUnit.getBitmap();
                int imgWidth = specialImageUnit.getWidth();
                int imgHeight = specialImageUnit.getHeight();
                if (imgWidth > 0 && imgHeight > 0) {
                    int bitWidth = bitmap.getWidth();
                    int bitHeight = bitmap.getHeight();

                    if (imgWidth < bitWidth && imgHeight < bitHeight) {
                        Bitmap newBitmap = ThumbnailUtils.extractThumbnail(bitmap, imgWidth, imgHeight);
                        if (null != newBitmap) {
                            bitmap.recycle();
                            specialImageUnit.setBitmap(newBitmap);
                        }
                    }
                }

                for (int startPos : startPoss) {
                    CustomImageSpan curCustomImageSpan = new CustomImageSpan(normalSizeText, specialImageUnit);
                    spannableStringBuilder.setSpan(curCustomImageSpan, startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

                    if (specialImageUnit.isClickable()) {
                        addClickStateChangeListeners(startPos, startPos + specialTextLength, curCustomImageSpan);
                    }
                }
            } else if (st instanceof SpecialLabelUnit) {
                // label span
                SpecialLabelUnit specialLabelUnit = (SpecialLabelUnit) st;
                for (int startPos : startPoss) {
                    CustomLabelSpan curCustomLabelSpan = new CustomLabelSpan(normalSizeText, specialLabelUnit);
                    spannableStringBuilder.setSpan(curCustomLabelSpan, startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

                    if (specialLabelUnit.isClickable()) {
                        addClickStateChangeListeners(startPos, startPos + specialTextLength, curCustomLabelSpan);
                    }
                }
            } else if (st instanceof SpecialClickableUnit) {
                // clickable span
                SpecialClickableUnit specialClickableUnit = (SpecialClickableUnit) st;

                if (!isInitClickListener) {
                    isInitClickListener = true;
                    TextView curTextView = specialClickableUnit.getCurTextView();
                    if (null != curTextView) {
                        curTextView.setMovementMethod(CustomLinkMovementMethod.getInstance());
                    }
                }

                int startPos = startPoss[0];
                spannableStringBuilder.setSpan(new CustomClickableSpan(specialClickableUnit), startPos, startPos + specialTextLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            } else if (st instanceof SpecialRawSpanUnit) {
                // raw span
                SpecialRawSpanUnit specialRawSpanUnit = (SpecialRawSpanUnit) st;

                int startPos = startPoss[0];
                spannableStringBuilder.setSpan(specialRawSpanUnit.getSpanObj(), startPos, startPos + specialTextLength, specialRawSpanUnit.getFlags());

                // Temporarily unable to support all
            }
        }

        return spannableStringBuilder;
    }
816787
public CodeBlock getInstance() {
        return CodeBlock.builder()
                .add( "new $T() {\n", ClassName.get( getMainClass() ) )
                .indent()
                .add( buildCreateMethod( getKeyClass(), key.getInstance() ) )
                .add( "\n" )
                .add( buildCreateMethod( getJsonClass(), json.getInstance() ) )
                .unindent()
                .add( "}" )
                .build();

    }
981358
public static final Parser<Boolean> instance() { // NOPMD it's thread save!
    if (BooleanParser.instanceParser == null) {
      synchronized (BooleanParser.class) {
        if (BooleanParser.instanceParser == null) {
          BooleanParser.instanceParser = new BooleanParser();
        }
      }
    }
    return BooleanParser.instanceParser;
  }
1013369
public function build(): SetAttributesAsTextRequest
	{
		$instance = new SetAttributesAsTextRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		if ($this->text === null) {
			throw new BuilderException('Property [text] is required.');
		}
		$instance->text = $this->text;
		$instance->name = $this->name;
		return $instance;
	}
115586
public Table build() {
        Table table = new Table();
        Thead _thead = thead.buildThead();
        if (_thead != null) {
            table.setThead(_thead);
        }
        Tfoot _tfoot = tfoot.buildTfoot();
        if (_tfoot != null) {
            table.setTfoot(_tfoot);
        }
        for (tbody _tbody : tbodyList) {
            table.getTbody().add(_tbody.buildTbody());
        }
        for (tr _tr : trList) {
            table.getTr().add(_tr.buildTr());
        }
        return table;
    }
180981
public AsyncMethodType<SessionBeanType<T>> getOrCreateAsyncMethod()
   {
      List<Node> nodeList = childNode.get("async-method");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new AsyncMethodTypeImpl<SessionBeanType<T>>(this, "async-method", childNode, nodeList.get(0));
      }
      return createAsyncMethod();
   }