Package org.springframework.data.mapping.model

Examples of org.springframework.data.mapping.model.MappingException


          TypeInformation<S> typeInformation) {
        return new BasicPersistentEntity<Object, SamplePersistentProperty>((TypeInformation<Object>) typeInformation) {
          @Override
          public void verify() {
            if (Unsupported.class.isAssignableFrom(getType())) {
              throw new MappingException("Unsupported type!");
            }
          }
        };
      }
    };
View Full Code Here


    if (!shouldCreatePersistentEntityFor(type)) {
      return null;
    }

    if (strict) {
      throw new MappingException("Unknown persistent entity " + type);
    }

    return addPersistentEntity(type);
  }
View Full Code Here

      String segment = iterator.next();
      P persistentProperty = current.getPersistentProperty(segment);

      if (persistentProperty == null) {
        throw new MappingException(String.format("No property %s found on %s!", segment, current.getName()));
      }

      result.add(persistentProperty);

      if (iterator.hasNext()) {
View Full Code Here

      }

      return entity;

    } catch (IntrospectionException e) {
      throw new MappingException(e.getMessage(), e);
    } finally {
      write.unlock();
    }
  }
View Full Code Here

    if (entity.hasVersionProperty()) {
      return new PropertyIsNullOrZeroNumberIsNewStrategy(entity.getVersionProperty());
    } else if (entity.hasIdProperty()) {
      return new PropertyIsNullIsNewStrategy(entity.getIdProperty());
    } else {
      throw new MappingException(String.format("Cannot determine IsNewStrategy for type %s!", type));
    }
  }
View Full Code Here

        if (currentToken == JsonToken.START_OBJECT) {
          return decodeObject(parser, (CouchbaseDocument) target);
        } else if (currentToken == JsonToken.START_ARRAY) {
          return decodeArray(parser, new CouchbaseList());
        } else {
          throw new MappingException("JSON to decode needs to start as array or object!");
        }
      }
      parser.close();
    } catch (IOException ex) {
      throw new RuntimeException("Could not decode JSON", ex);
View Full Code Here

      case VALUE_NUMBER_FLOAT:
        return parser.getValueAsDouble();
      case VALUE_NULL:
        return null;
      default:
        throw new MappingException("Could not decode primitve value " + token);
    }
  }
View Full Code Here

    }

    String fieldName = fieldNamingStrategy.getFieldName(this);

    if (!StringUtils.hasText(fieldName)) {
      throw new MappingException(String.format("Invalid (null or empty) field name returned for property %s by %s!",
        this, fieldNamingStrategy.getClass()));
    }

    return fieldName;
  }
View Full Code Here

  @Override
  public <T, ID extends Serializable> CouchbaseEntityInformation<T, ID> getEntityInformation(final Class<T> domainClass) {
    CouchbasePersistentEntity<?> entity = mappingContext.getPersistentEntity(domainClass);

    if (entity == null) {
      throw new MappingException(String.format("Could not lookup mapping metadata for domain class %s!", domainClass.getName()));
    }

    return new MappingCouchbaseEntityInformation<T, ID>((CouchbasePersistentEntity<T>) entity);
  }
View Full Code Here

  @Override
  public Object deserializeValue(String value) {
    try {
      return SimpleDBAttributeConverter.decodeToFieldOfType(value, getField().getType());
    } catch(IllegalArgumentException e) {
      throw new MappingException("Could not map attributes", e);
    } catch(ParseException e) {
      throw new MappingException("Could not map attributes", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.mapping.model.MappingException

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.