Esempio n. 1
0
 public static FunctionMirror newInstance(ExecutableElement method, ProcessingEnvironment env) {
   assertNotNull(env);
   AnnotationMirror annotationMirror =
       ElementUtil.getAnnotationMirror(method, Function.class, env);
   if (annotationMirror == null) {
     return null;
   }
   FunctionMirror result = new FunctionMirror(annotationMirror, method.getSimpleName().toString());
   for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry :
       env.getElementUtils().getElementValuesWithDefaults(annotationMirror).entrySet()) {
     String name = entry.getKey().getSimpleName().toString();
     AnnotationValue value = entry.getValue();
     if ("catalog".equals(name)) {
       result.catalog = value;
     } else if ("schema".equals(name)) {
       result.schema = value;
     } else if ("name".equals(name)) {
       result.name = value;
     } else if ("queryTimeout".equals(name)) {
       result.queryTimeout = value;
     } else if ("mapKeyNaming".equals(name)) {
       result.mapKeyNaming = value;
     } else if ("ensureResultMapping".equals(name)) {
       result.ensureResultMapping = value;
     }
   }
   return result;
 }
Esempio n. 2
0
 public static boolean isEqual(Object object, AnnotationValue value) {
   assertNotNull(object);
   if (value == null) {
     return false;
   }
   return object.equals(value.getValue());
 }
Esempio n. 3
0
 public DomainTypeGenerator(
     ProcessingEnvironment env, TypeElement domainElement, DomainMeta domainMeta)
     throws IOException {
   super(env, domainElement, null, null, Constants.METATYPE_PREFIX, "");
   assertNotNull(domainMeta);
   this.domainMeta = domainMeta;
   this.typeName = TypeMirrorUtil.getTypeName(domainMeta.getType(), env);
   this.metaTypeName = MetaUtil.getMetaTypeName(typeName);
   this.simpleMetaTypeName = MetaUtil.getSimpleMetaTypeName(typeName);
   this.typeParamDecl = makeTypeParamDecl(typeName);
 }
 public void setElements(Iterable<ELEMENT> elements) {
   assertNotNull(elements);
   if (elements instanceof Collection<?>) {
     this.elements = new ArrayList<ELEMENT>((Collection<ELEMENT>) elements);
   } else {
     this.elements = new ArrayList<ELEMENT>();
     for (ELEMENT element : elements) {
       this.elements.add(element);
     }
   }
   this.sqls = new ArrayList<PreparedSql>(this.elements.size());
 }
Esempio n. 5
0
 public static <T> T invoke(Method method, Object target, Object... params) throws WrapException {
   assertNotNull(method);
   try {
     @SuppressWarnings("unchecked")
     T result = (T) method.invoke(target, params);
     return result;
   } catch (IllegalArgumentException e) {
     throw new WrapException(e);
   } catch (IllegalAccessException e) {
     throw new WrapException(e);
   } catch (InvocationTargetException e) {
     throw new WrapException(e);
   }
 }
Esempio n. 6
0
 public static EntityMirror newInstance(TypeElement clazz, ProcessingEnvironment env) {
   assertNotNull(env);
   AnnotationMirror annotationMirror = ElementUtil.getAnnotationMirror(clazz, Entity.class, env);
   if (annotationMirror == null) {
     return null;
   }
   EntityMirror result = new EntityMirror(annotationMirror);
   for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry :
       env.getElementUtils().getElementValuesWithDefaults(annotationMirror).entrySet()) {
     String name = entry.getKey().getSimpleName().toString();
     AnnotationValue value = entry.getValue();
     if ("listener".equals(name)) {
       result.listener = value;
     } else if ("naming".equals(name)) {
       result.naming = value;
     } else if ("immutable".equals(name)) {
       result.immutable = value;
     }
   }
   return result;
 }
Esempio n. 7
0
 public PreparedSqlBuilder(Config config, SqlKind kind) {
   assertNotNull(config, kind);
   this.config = config;
   this.kind = kind;
   this.formattingFunction = new ConvertToLogFormatFunction();
 }
Esempio n. 8
0
 protected FunctionMirror(AnnotationMirror annotationMirror, String defaltName) {
   assertNotNull(annotationMirror, defaltName);
   this.annotationMirror = annotationMirror;
   this.defaultName = defaltName;
 }
Esempio n. 9
0
 public TableIdGeneratorMeta(TableGeneratorMirror tableGeneratorMirror) {
   assertNotNull(tableGeneratorMirror);
   this.tableGeneratorMirror = tableGeneratorMirror;
 }
Esempio n. 10
0
 protected AutoModifyQuery(EntityType<E> entityType) {
   AssertionUtil.assertNotNull(entityType);
   this.entityType = entityType;
 }
Esempio n. 11
0
 @Override
 public void prepare() {
   super.prepare();
   assertNotNull(method, sqlFilePath, parameterName, elements, sqls);
 }
Esempio n. 12
0
 protected SqlFileBatchModifyQuery(Class<ELEMENT> elementClass, SqlKind kind) {
   assertNotNull(elementClass, kind);
   this.elementClass = elementClass;
   this.kind = kind;
 }
Esempio n. 13
0
 public ExternalDomainMeta(TypeElement typeElement) {
   assertNotNull(typeElement);
   this.typeElement = typeElement;
 }