Defines the media type(s) that the methods can produce
@param MediaType producesDef - mediaType to be parsed
12814
function Produces(producesDef) {
    return function (target, propertyKey, descriptor) {
        descriptor.isJSON = producesDef === MediaType.JSON;
        return descriptor;
    };
}
1032175
@DELETE
    @Path("/typedefs")
    @Consumes(Servlets.JSON_MEDIA_TYPE)
    @Produces(Servlets.JSON_MEDIA_TYPE)
    @Experimental
    public void deleteAtlasTypeDefs(final AtlasTypesDef typesDef) throws AtlasBaseException {
        AtlasPerfTracer perf = null;

        try {
            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "TypesREST.deleteAtlasTypeDefs(" +
                                                               AtlasTypeUtil.toDebugString(typesDef) + ")");
            }

            typeDefStore.deleteTypesDef(typesDef);
        } finally {
            AtlasPerfTracer.log(perf);
        }
    }
522870
function(doctype){
    if (doctype && (doctype.val || !this.doctype)) {
      this.setDoctype(doctype.val || 'html');
    }

    if (this.doctype) this.buffer(this.doctype);
    this.hasCompiledDoctype = true;
  }
79687
@Override
    public void setDefaultMediaType(String mediaType) {
        if (mediaType != null) {
            int i = mediaType.indexOf('/');
            if (i == -1 || i != mediaType.lastIndexOf('/'))
                throw new IllegalArgumentException("Media-type must follow the pattern {type}/{subtype}");
        }
        this.defaultMediaType = mediaType;
    }
1025851
function Builder(mediaType, linkType) {
  this.mediaType = mediaType || mediaTypes.CONTENT_NEGOTIATION;
  this.linkType = linkType || 'link-rel';
  this.adapter = this._createAdapter(this.mediaType);
  this.autoHeaders = true;
  this.contentNegotiation = true;
  this.rawPayloadFlag = false;
  this.convertResponseToObjectFlag = false;
  this.links = [];
  this.jsonParser = JSON.parse;
  this.requestModuleInstance = standardRequest;
  this.requestOptions = {};
  this.resolveRelativeFlag = false;
  this.preferEmbedded = false;
  this.lastTraversalState = null;
  this.continuation = null;
  // Maintenance notice: when extending the list of configuration parameters,
  // also extend this.newRequest and initFromTraversalState
}
384576
function createTypedef(context, typeName, value) {
  if (value instanceof Reference) {
    value = value.resolve(context);
  }
  context.results[typeName] = value;
  return value;
}
513743
protected final void setDerivedEndType() {

        m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)
        ? EndType.SINGLE
        : null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;
    }
718563
public static MediaType valueOf(String type) throws IllegalArgumentException {
        if (type == null || type.trim().isEmpty() || type.startsWith(SUBTYPE_SEPARATOR) || type.endsWith(SUBTYPE_SEPARATOR)) {
            throw new IllegalArgumentException("Invalid mime type '" + type + "'");
        }
        String[] splitType = type.split(SUBTYPE_SEPARATOR);
        if (splitType.length == 2) {
            nonEmpty(type, splitType[0]);
            nonEmpty(type, splitType[1]);
            Map<String, String> parameters = new HashMap<>();
            String subType = splitType[1];
            if (splitType[1].contains(PARAMETERS_SEPARATOR)) {
                String[] subTypeWithparameter = splitType[1].split(PARAMETERS_SEPARATOR);
                String paramString = subTypeWithparameter[1].trim();
                subType = subTypeWithparameter[0];
                parameters = parseParameters(paramString);
            }
            return new MediaType(splitType[0].trim(), subType.trim(), parameters);
        }
        if (!type.contains(SUBTYPE_SEPARATOR)) {
            String mimeType = mimeMappings.getMimeType(type);
            if (mimeType != null) {
                return valueOf(mimeType);
            }
        }
        throw new IllegalArgumentException("Invalid mime type '" + type + "'");
    }
463887
public ApiListingBuilder produces(Set<String> mediaTypes) {
    if (mediaTypes != null) {
      this.produces = new HashSet<>(mediaTypes);
    }
    return this;
  }
454627
private static List<MediaType> producibleMediaTypes(Method method, Class<?> clazz) {
        List<Produces> produces = findAll(method, Produces.class);
        List<ProduceType> produceTypes = findAll(method, ProduceType.class);

        if (produces.isEmpty() && produceTypes.isEmpty()) {
            produces = findAll(clazz, Produces.class);
            produceTypes = findAll(clazz, ProduceType.class);
        }

        final List<MediaType> types =
                Stream.concat(produces.stream().map(Produces::value),
                              produceTypes.stream().map(ProduceType::value))
                      .map(MediaType::parse)
                      .peek(type -> {
                          if (type.hasWildcard()) {
                              throw new IllegalArgumentException(
                                      "Producible media types must not have a wildcard: " + type);
                          }
                      })
                      .collect(toImmutableList());
        return ensureUniqueTypes(types, Produces.class);
    }
205294
public static void get(String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) {
        addResource(Methods.GET, url, endpoint, mediaTypes);
    }
1015333
public static MediaType binary( MediaType.Type type, String subType ) {
        return new MediaType( type, subType, true );
    }
216667
protected T get(Class<?> type,
	                Class<? extends T> byDefinition,
	                InjectionProvider provider,
	                RoutingContext routeContext,
	                MediaType[] mediaTypes) throws ClassFactoryException,
	                                               ContextException {

		Class<? extends T> clazz = byDefinition;

		// No class defined ... try by type
		if (clazz == null) {
			clazz = get(type);
		}

		// try with media type ...
		if (clazz == null && mediaTypes != null && mediaTypes.length > 0) {

			for (MediaType mediaType : mediaTypes) {
				clazz = get(mediaType);

				if (clazz != null) {
					break;
				}
			}
		}

		if (clazz != null) {
			return getClassInstance(clazz, provider, routeContext);
		}

		// 3. find cached instance ... if any
		return cache.get(type.getName());
	}
159152
public static MediaType parseMediaType(String mediaType) {
		Assert.hasLength(mediaType, "'mediaType' must not be empty");
		String[] parts = StringUtils.tokenizeToStringArray(mediaType, ";");

		String fullType = parts[0].trim();
		// java.net.HttpURLConnection returns a *; q=.2 Accept header
		if (WILDCARD_TYPE.equals(fullType)) {
			fullType = "*/*";
		}
		int subIndex = fullType.indexOf('/');
		if (subIndex == -1) {
			throw new InvalidMediaTypeException(mediaType, "does not contain '/'");
		}
		if (subIndex == fullType.length() - 1) {
			throw new InvalidMediaTypeException(mediaType, "does not contain subtype after '/'");
		}
		String type = fullType.substring(0, subIndex);
		String subtype = fullType.substring(subIndex + 1, fullType.length());
		if (WILDCARD_TYPE.equals(type) && !WILDCARD_TYPE.equals(subtype)) {
			throw new InvalidMediaTypeException(mediaType, "wildcard type is legal only in '*/*' (all media types)");
		}

		Map<String, String> parameters = null;
		if (parts.length > 1) {
			parameters = new LinkedHashMap<String, String>(parts.length - 1);
			for (int i = 1; i < parts.length; i++) {
				String parameter = parts[i];
				int eqIndex = parameter.indexOf('=');
				if (eqIndex != -1) {
					String attribute = parameter.substring(0, eqIndex);
					String value = parameter.substring(eqIndex + 1, parameter.length());
					parameters.put(attribute, value);
				}
			}
		}

		try {
			return new MediaType(type, subtype, parameters);
		}
		catch (UnsupportedCharsetException ex) {
			throw new InvalidMediaTypeException(mediaType, "unsupported charset '" + ex.getCharsetName() + "'");
		}
		catch (IllegalArgumentException ex) {
			throw new InvalidMediaTypeException(mediaType, ex.getMessage());
		}
	}
191694
public void setContentType(MediaType mediaType) {
		Assert.isTrue(!mediaType.isWildcardType(), "'Content-Type' cannot contain wildcard type '*'");
		Assert.isTrue(!mediaType.isWildcardSubtype(), "'Content-Type' cannot contain wildcard subtype '*'");
		set(CONTENT_TYPE, mediaType.toString());
	}
107262
@Override
    public ProtocolDef protocol(String type) {
        return new ProtocolDefImpl(
                getDescriptorName(),
                getRootNode(),
                container,
                container.getOrCreate("protocol@type=" + type));
    }
642125
@Override
	public void generateSpecializedPart(SQLiteModelMethod method, TypeSpec.Builder classBuilder, MethodSpec.Builder methodBuilder, Set<JQLProjection> fieldList, boolean mapFields) {
		//ASSERT: returnType is a supported type
		
		// no column or too many columns
		AssertKripton.assertTrueOrInvalidMethodSignException(fieldList.size() == 1, method, "only one field can be defined as result for this method");				

		ParameterizedTypeName returnListName = (ParameterizedTypeName) method.getReturnClass();;

		TypeName collectionClass;
		ClassName listClazzName = returnListName.rawType;
		TypeName elementName = returnListName.typeArguments.get(0);

		collectionClass = SqlUtility.defineCollection(listClazzName);

		methodBuilder.addCode("\n");
		
		if (TypeUtility.isTypeEquals(collectionClass, TypeUtility.typeName(ArrayList.class))) {			
			methodBuilder.addStatement("$T<$T> resultList=new $T<$T>(_cursor.getCount())", collectionClass, elementName, collectionClass, elementName);
		} else {			
			methodBuilder.addStatement("$T<$T> resultList=new $T<$T>()", collectionClass, elementName, collectionClass, elementName);
		}
		methodBuilder.addCode("\n");
		
		SQLTransform t=SQLTransformer.lookup(returnListName);

		//@formatter:off
		methodBuilder.addCode("\n");
			methodBuilder.beginControlFlow("if (_cursor.moveToFirst())");
				methodBuilder.addCode("\n");
				methodBuilder.beginControlFlow("do\n");
					methodBuilder.beginControlFlow("if (!_cursor.isNull(0))");
						methodBuilder.addCode("resultList.add(");
						t.generateReadValueFromCursor(methodBuilder, method.getParent(), elementName, "_cursor", "0");
						methodBuilder.addCode(");\n");
					methodBuilder.nextControlFlow("else");
						methodBuilder.addCode("resultList.add(null);\n");		
					methodBuilder.endControlFlow();
				methodBuilder.endControlFlow("while (_cursor.moveToNext())");
			methodBuilder.endControlFlow();
			methodBuilder.addCode("return resultList;\n");
		methodBuilder.endControlFlow();
		//@formatter:on

	}