Package ca.uhn.fhir.context

Examples of ca.uhn.fhir.context.ConfigurationException


    } else if (IResource.class.isAssignableFrom(methodReturnType)) {
      myMethodReturnType = MethodReturnTypeEnum.RESOURCE;
    } else if (Bundle.class.isAssignableFrom(methodReturnType)) {
      myMethodReturnType = MethodReturnTypeEnum.BUNDLE;
    } else {
      throw new ConfigurationException("Invalid return type '" + methodReturnType.getCanonicalName() + "' on method '" + theMethod.getName() + "' on type: " + theMethod.getDeclaringClass().getCanonicalName());
    }

    if (theReturnResourceType != null) {
      ResourceDef resourceDefAnnotation = theReturnResourceType.getAnnotation(ResourceDef.class);
      if (resourceDefAnnotation == null) {
        throw new ConfigurationException(theReturnResourceType.getCanonicalName() + " has no @" + ResourceDef.class.getSimpleName() + " annotation");
      }
      myResourceName = resourceDefAnnotation.name();
    }
  }
View Full Code Here


  public ConformanceMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
    super(Conformance.class, theMethod, theContext, theProvider);

    if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || theMethod.getReturnType() != Conformance.class) {
      throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return type " + Conformance.class);
    }

  }
View Full Code Here

  }

  @Override
  public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
    if (theOuterCollectionType != null || theInnerCollectionType != null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + Sort.class.getName() + " but can not be of collection type");
    }
    if (!theParameterType.equals(SortSpec.class)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + Sort.class.getName() + " but is an invalid type, must be: " + SortSpec.class.getCanonicalName());
    }

  }
View Full Code Here

  public ConformanceMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
    super(Conformance.class, theMethod, theContext, theProvider);

    if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || theMethod.getReturnType() != Conformance.class) {
      throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return type " + Conformance.class);
    }

  }
View Full Code Here

  }

  @Override
  public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
    if (theOuterCollectionType != null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + TransactionParam.class.getName() + " but can not be a collection of collections");
    }
    if (theInnerCollectionType.equals(List.class)==false) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()+">");
    }
    if (theParameterType.equals(IResource.class)==false) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" +theMethod.getDeclaringClass().getCanonicalName()+ "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()+">");
    }
  }
View Full Code Here

  }

  @Override
  public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) {
    if (theOuterCollectionType != null) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + "' is annotated with @" + Since.class.getName() + " but can not be of collection type");
    }
    if (!ParameterUtil.getBindableInstantTypes().contains(theParameterType)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + "' is annotated with @" + Since.class.getName() + " but is an invalid type, must be one of: " + ParameterUtil.getBindableInstantTypes());
    }
    myType = theParameterType;
  }
View Full Code Here

    myIdIndex = idIndex;
    myVersionIdIndex = versionIdIndex;

    Class<?>[] parameterTypes = theMethod.getParameterTypes();
    if (!IdDt.class.equals(parameterTypes[myIdIndex])) {
      throw new ConfigurationException("ID parameter must be of type: " + IdDt.class.getCanonicalName() + " - Found: " + parameterTypes[myIdIndex]);
    }
    if (myVersionIdIndex != null && !IdDt.class.equals(parameterTypes[myVersionIdIndex])) {
      throw new ConfigurationException("Version ID parameter must be of type: " + IdDt.class.getCanonicalName() + " - Found: " + parameterTypes[myVersionIdIndex]);
    }

  }
View Full Code Here

    } else if (theCollectionType .equals( Set.class )|| theCollectionType .equals( HashSet.class)) {
      return (Class<? extends Collection>) HashSet.class;
    } else if (theCollectionType.equals(Collection.class)) {
      return (Class<? extends Collection>) ArrayList.class;
    } else {
      throw new ConfigurationException("Unsupported binding collection type '" + theCollectionType.getCanonicalName() + "' for " + thePositionDescription);
    }
  }
View Full Code Here

    myIdParamIndex = ParameterUtil.findIdParameterIndex(theMethod);
    myVersionIdParamIndex = ParameterUtil.findVersionIdParameterIndex(theMethod);

    if (myIdParamIndex != null && myType.equals(IResource.class)) {
      throw new ConfigurationException("Method '" + theMethod.getName() + "' does not specify a resource type, but has an @" + IdParam.class.getSimpleName() + " parameter. Please specity a resource type in the @" + GetTags.class.getSimpleName() + " annotation");
    }
  }
View Full Code Here

        theEventWriter.writeEnd();
      } else {
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(value.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(value.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName);
      }
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.context.ConfigurationException

Copyright © 2018 www.massapicom. 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.