test_class.declarator: mediaTypeHeaderDelegate
test_class.modifier: private
test_class.original_string: private MediaTypeHeaderDelegate mediaTypeHeaderDelegate;
test_class.type: MediaTypeHeaderDelegate
test_class.var_name: mediaTypeHeaderDelegate
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/header/MediaTypeHeaderDelegateTest.java
test_class.identifier: MediaTypeHeaderDelegateTest
test_case.body: @Test(expected = IllegalArgumentException.class)
      public void throwsExceptionWhenContentTypeHeaderIsNull() throws Exception {
          mediaTypeHeaderDelegate.fromString(null);
      }
test_case.class_method_signature: MediaTypeHeaderDelegateTest.throwsExceptionWhenContentTypeHeaderIsNull()
test_case.full_signature: @Test(expected = IllegalArgumentException.class) public void throwsExceptionWhenContentTypeHeaderIsNull()
test_case.identifier: throwsExceptionWhenContentTypeHeaderIsNull
test_case.invocations: fromString
test_case.modifiers: @Test(expected = IllegalArgumentException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void throwsExceptionWhenContentTypeHeaderIsNull()
focal_class.declarator: SUB_TYPE_SEPARATOR = '/'
focal_class.modifier: private static final
focal_class.original_string: private static final char SUB_TYPE_SEPARATOR = '/';
focal_class.type: char
focal_class.var_name: SUB_TYPE_SEPARATOR
focal_class.declarator: PARAMS_SEPARATOR = ';'
focal_class.modifier: private static final
focal_class.original_string: private static final char PARAMS_SEPARATOR = ';';
focal_class.type: char
focal_class.var_name: PARAMS_SEPARATOR
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/header/MediaTypeHeaderDelegate.java
focal_class.identifier: MediaTypeHeaderDelegate
focal_class.interfaces: implements RuntimeDelegate.HeaderDelegate<MediaType>
focal_class.class_method_signature: MediaTypeHeaderDelegate.fromString(String header)
focal_class.full_signature: @Override public MediaType fromString(String header)
focal_class.identifier: fromString
focal_class.modifiers: @Override public
focal_class.parameters: (String header)
focal_class.return: MediaType
focal_class.signature: MediaType fromString(String header)
focal_class.class_method_signature: MediaTypeHeaderDelegate.toString(MediaType mime)
focal_class.full_signature: @Override public String toString(MediaType mime)
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: (MediaType mime)
focal_class.return: String
focal_class.signature: String toString(MediaType mime)
focal_method.body: @Override
      public MediaType fromString(String header) {
          if (header == null) {
              throw new IllegalArgumentException();
          }
  
          try {
              int subTypeSeparatorIndex = scan(header, SUB_TYPE_SEPARATOR);
              int paramsSeparatorIndex = scan(header, PARAMS_SEPARATOR);
  
              String type;
              String subType;
  
              if (charAtIsNot(header, subTypeSeparatorIndex, SUB_TYPE_SEPARATOR)
                  && charAtIsNot(header, paramsSeparatorIndex, PARAMS_SEPARATOR)) {
  
                  return new MediaType(header, null);
  
              } else if (charAtIs(header, subTypeSeparatorIndex, SUB_TYPE_SEPARATOR)
                         && charAtIsNot(header, paramsSeparatorIndex, PARAMS_SEPARATOR)) {
  
                  return new MediaType(removeWhitespaces(header.substring(0, subTypeSeparatorIndex)),
                                       removeWhitespaces(header.substring(subTypeSeparatorIndex + 1)));
  
              } else if (charAtIsNot(header, subTypeSeparatorIndex, SUB_TYPE_SEPARATOR) && paramsSeparatorIndex == 0) {
  
                  // string just start from ';'
                  type = null;
                  subType = null;
  
              } else if (charAtIsNot(header, subTypeSeparatorIndex, SUB_TYPE_SEPARATOR)
                         && charAtIs(header, paramsSeparatorIndex, PARAMS_SEPARATOR)) {
  
                  // there is no '/' but present ';'
                  type = removeWhitespaces(header.substring(0, paramsSeparatorIndex));
                  subType = null;
  
              } else {
  
                  type = removeWhitespaces(header.substring(0, subTypeSeparatorIndex));
                  subType = header.substring(subTypeSeparatorIndex + 1, paramsSeparatorIndex);
  
              }
  
              Map<String, String> params = new HeaderParameterParser().parse(header);
              return new MediaType(type, subType, params);
  
          } catch (ParseException e) {
              throw new IllegalArgumentException(e);
          }
      }
focal_method.class_method_signature: MediaTypeHeaderDelegate.fromString(String header)
focal_method.full_signature: @Override public MediaType fromString(String header)
focal_method.identifier: fromString
focal_method.invocations: scan scan charAtIsNot charAtIsNot charAtIs charAtIsNot removeWhitespaces substring removeWhitespaces substring charAtIsNot charAtIsNot charAtIs removeWhitespaces substring removeWhitespaces substring substring parse
focal_method.modifiers: @Override public
focal_method.parameters: (String header)
focal_method.return: MediaType
focal_method.signature: MediaType fromString(String header)