Examples of IParser


Examples of ca.uhn.fhir.parser.IParser

            ourLog.debug("No content in response, not going to read", e);
            reader = null;
          }

          if (reader != null) {
            IParser parser = ct.newParser(getContext());
            OperationOutcome outcome = parser.parseResource(OperationOutcome.class, reader);
            retVal.setOperationOutcome(outcome);
          }

        } else {
          ourLog.debug("Ignoring response content of type: {}", theResponseMimeType);
        }
      }
      return retVal;
    case Constants.STATUS_HTTP_400_BAD_REQUEST:
      throw new InvalidRequestException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_404_NOT_FOUND:
      throw new ResourceNotFoundException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_405_METHOD_NOT_ALLOWED:
      throw new MethodNotAllowedException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_409_CONFLICT:
      throw new ResourceVersionConflictException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_412_PRECONDITION_FAILED:
      throw new ResourceVersionNotSpecifiedException("Server responded with: " + IOUtils.toString(theResponseReader));
    case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
      IParser parser = createAppropriateParser(theResponseMimeType, theResponseReader, theResponseStatusCode);
      OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
      throw new UnprocessableEntityException(operationOutcome);
    default:
      throw new UnclassifiedServerFailureException(theResponseStatusCode, IOUtils.toString(theResponseReader));
    }
View Full Code Here

Examples of com.flaptor.util.parser.IParser

        return "text/html";
    }
   
    private IParser getParser() {
        final int HTML = 1, PDF = 2;
        IParser parser = null;
        int docType = 0;
        String mimetype = header.get("content-type");
        if ("text/html".equals(mimetype)) {
            docType = HTML;
        } else if ("application/pdf".equals(mimetype)) {
View Full Code Here

Examples of greed.conf.parser.IParser

                Method setter = ReflectionUtil.findSetter(configClass, field);
                if (setter == null) {
                    throw new ConfigException(String.format("FATAL: Unable to find setter for %s in class %s", field.getName(), configClass.getName()));
                }

                IParser parser = null;
                if (field.isAnnotationPresent(Parser.class)) {
                    Class<? extends IParser> parserClass = field.getAnnotation(Parser.class).value();
                    parser = parserClass.newInstance();
                }

                Class<?> fieldType = field.getType();
                hasSet.add(field.getName());
                if (fieldType.isPrimitive() || String.class.equals(fieldType) || fieldType.isEnum()) {
                    setter.invoke(configObject,
                            parser != null ? parser.apply(rawConf.getAnyRef(field.getName())) : parseAndCheck(path + "." + field.getName(), rawConf.getAnyRef(field.getName()), fieldType));
                }
                else if (fieldType.isArray()) {
                    Class<?> elementType = fieldType.getComponentType();
                    List<?> rawValues = rawConf.getAnyRefList(field.getName());
                    Object values = Array.newInstance(elementType, rawValues.size());
                    int idx = 0;
                    for (Object rv: rawValues) {
                        Array.set(values, idx,
                                parser != null ? parser.apply(rv) : parseAndCheck(String.format("%s.[%d]", path, idx), rv, elementType));
                        idx++;
                    }
                    setter.invoke(configObject, values);
                }
                else if (field.isAnnotationPresent(MapParam.class)) {
                    HashMap<Object, Object> map = new HashMap<Object, Object>();
                    Class<?> valueClass = field.getAnnotation(MapParam.class).value();
                    for (Map.Entry<String, ConfigValue> entry : rawConf.getObject(field.getName()).entrySet()) {
                        map.put(entry.getKey(),
                                parser != null ? parser.apply(entry.getValue()) : parseAndCheck(path + "." + field.getName() + "." + entry.getKey(), entry.getValue(), valueClass));
                    }
                    setter.invoke(configObject, map);
                }
                else if (fieldType.isAnnotationPresent(ConfigObjectClass.class)) {
                    setter.invoke(configObject, parseAndCheck(path + "." + field.getName(), rawConf.getConfig(field.getName()), fieldType));
                }
                else if (parser != null) {
                    setter.invoke(configObject, parser.apply(rawConf.getAnyRef(field.getName())));
                }
                else {
                    throw new ConfigException(String.format("Field %s with unknown type %s at path %s", field.getName(), fieldType.getSimpleName(), path));
                }
            }
View Full Code Here

Examples of net.sf.jmd.transformation.IParser

    public IModel transform(List<File> modelFileList) throws MoDiException {
        IModel result = new Model();
        IModelItem item = null;

        IParser joda = new JavaParser();
        ITreeWalker luke = new ASTtoMetaRepresentationTransformer();
       
        for (File file : modelFileList) {
            //TODO remove debug
//           LOGGER.info("parsing file: " + file.getAbsolutePath());
            AST ast = joda.getAST(file);// parse the file
            item = luke.walk(ast); // build a ModelItem from the AST
            result.addModelItem(item); // add it to the model
        }
       
        return result;
View Full Code Here

Examples of net.sourceforge.veditor.parser.IParser

   */
  public boolean refreshOutline() throws HdlParserException{
    if(m_NeedToRefresh){
      m_NeedToRefresh=false;
      getOutlineContainer(false).clear();
      IParser parser = createParser(get());
      VerilogPlugin.deleteMarkers(getFile());
      try{
        parser.parse();
      }
      catch (HdlParserException e){
        throw e;
      }
      OutlineDatabase database = OutlineDatabase.getProjectsDatabase(getProject());
View Full Code Here

Examples of org.dyno.visual.swing.parser.spi.IParser

  public boolean generateCode(IType type, ImportRewrite imports, IProgressMonitor monitor) {
    int count = ((CompositeAdapter)adaptable).getChildCount();
    for (int i = 0; i < count; i++) {
      Component child = ((CompositeAdapter)adaptable).getChild(i);
      WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
      IParser parser = (IParser) childAdapter.getAdapter(IParser.class);
      if (parser!=null&&!parser.generateCode(type, imports, monitor))
        return false;
    }
    if (!adaptable.isCodeDirty())
      return true;
    return super.generateCode(type, imports, monitor);
View Full Code Here

Examples of org.eclipse.gmf.runtime.common.ui.services.parser.IParser

    return new ICellEditorValidator() {

      public String isValid(final Object value) {
        if (value instanceof String) {
          final EObject element = getParserElement();
          final IParser parser = getParser();
          try {
            IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
                .runExclusive(new RunnableWithResult.Impl() {

                  public void run() {
                    setResult(parser.isValidEditString(
                        new EObjectAdapter(element),
                        (String) value));
                  }
                });
            return valid.getCode() == ParserEditStatus.EDITABLE ? null
View Full Code Here

Examples of org.eclipse.gmf.runtime.common.ui.services.parser.IParser

    return new ICellEditorValidator() {

      public String isValid(final Object value) {
        if (value instanceof String) {
          final EObject element = getParserElement();
          final IParser parser = getParser();
          try {
            IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
                .runExclusive(new RunnableWithResult.Impl() {

                  public void run() {
                    setResult(parser.isValidEditString(
                        new EObjectAdapter(element),
                        (String) value));
                  }
                });
            return valid.getCode() == ParserEditStatus.EDITABLE ? null
View Full Code Here

Examples of org.eclipse.gmf.runtime.common.ui.services.parser.IParser

    return new ICellEditorValidator() {

      public String isValid(final Object value) {
        if (value instanceof String) {
          final EObject element = getParserElement();
          final IParser parser = getParser();
          try {
            IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
                .runExclusive(new RunnableWithResult.Impl() {

                  public void run() {
                    setResult(parser.isValidEditString(
                        new EObjectAdapter(element),
                        (String) value));
                  }
                });
            return valid.getCode() == ParserEditStatus.EDITABLE ? null
View Full Code Here

Examples of org.eclipse.gmf.runtime.common.ui.services.parser.IParser

    return new ICellEditorValidator() {

      public String isValid(final Object value) {
        if (value instanceof String) {
          final EObject element = getParserElement();
          final IParser parser = getParser();
          try {
            IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
                .runExclusive(new RunnableWithResult.Impl() {

                  public void run() {
                    setResult(parser.isValidEditString(
                        new EObjectAdapter(element),
                        (String) value));
                  }
                });
            return valid.getCode() == ParserEditStatus.EDITABLE ? null
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.