List of usage examples for java.lang.annotation AnnotationTypeMismatchException AnnotationTypeMismatchException
public AnnotationTypeMismatchException(Method element, String foundType)
From source file:kina.config.EntityCassandraKinaConfig.java
@Override public void validate() { if (entityClass == null) { throw new IllegalArgumentException("testentity class cannot be null"); }/*from w w w .j a va2 s .c o m*/ if (!entityClass.isAnnotationPresent(Entity.class)) { throw new AnnotationTypeMismatchException(null, entityClass.getCanonicalName()); } super.validate(); /* let's validate fieldNames in @Field annotations */ Field[] kinaFields = CassandraUtils.filterKinaFields(entityClass); Map<String, Cell> colDefs = super.columnDefinitions(); /* colDefs is null if table does not exist. I.E. this configuration will be used as an output configuration object, and the output table is dynamically created */ if (colDefs == null) { return; } for (Field field : kinaFields) { String annotationFieldName = CassandraUtils.kinaFieldName(field); if (!colDefs.containsKey(annotationFieldName)) { throw new NoSuchFieldException("Unknown column name \'" + annotationFieldName + "\' specified for" + " field " + entityClass.getCanonicalName() + "#" + field.getName() + ". Please, " + "make sure the field name you specify in @Field annotation matches _exactly_ the column " + "name " + "in the database"); } } }
From source file:com.stratio.deep.cassandra.config.EntityDeepJobConfig.java
@Override public void validate() { if (entityClass == null) { throw new IllegalArgumentException("testentity class cannot be null"); }//from ww w .j a v a2 s . co m if (!entityClass.isAnnotationPresent(DeepEntity.class)) { throw new AnnotationTypeMismatchException(null, entityClass.getCanonicalName()); } super.validate(); /* let's validate fieldNames in @DeepField annotations */ Field[] deepFields = AnnotationUtils.filterDeepFields(entityClass); Map<String, Cell> colDefs = super.columnDefinitions(); /* colDefs is null if table does not exist. I.E. this configuration will be used as an output configuration object, and the output table is dynamically created */ if (colDefs == null) { return; } for (Field field : deepFields) { String annotationFieldName = AnnotationUtils.deepFieldName(field); if (!colDefs.containsKey(annotationFieldName)) { throw new DeepNoSuchFieldException("Unknown column name \'" + annotationFieldName + "\' specified for" + " field " + entityClass.getCanonicalName() + "#" + field.getName() + ". Please, " + "make sure the field name you specify in @DeepField annotation matches _exactly_ the column " + "name " + "in the database"); } } }