コード例 #1
0
 private void injectAssociationProperties(ClassNode classNode, List propertiesToAdd) {
   for (Iterator i = propertiesToAdd.iterator(); i.hasNext(); ) {
     PropertyNode pn = (PropertyNode) i.next();
     if (! /*GrailsASTUtils.*/hasProperty(classNode, pn.getName())) {
       // if(LOG.isDebugEnabled()) {
       //    LOG.debug("[GrailsDomainInjector] Adding property [" + pn.getName() + "] to class [" +
       // classNode.getName() + "]");
       // }
       classNode.addProperty(pn);
     }
   }
 }
コード例 #2
0
  private void injectIdProperty(ClassNode classNode) {
    final boolean hasId = /*GrailsASTUtils.*/
        hasProperty(classNode, /*GrailsDomainClassProperty.*/ IDENTITY);

    if (!hasId) {
      // if(LOG.isDebugEnabled()) {
      //    LOG.debug("[GrailsDomainInjector] Adding property [" +
      // GrailsDomainClassProperty.IDENTITY + "] to class [" + classNode.getName() + "]");
      // }
      classNode.addProperty(
          /*GrailsDomainClassProperty.*/ IDENTITY,
          Modifier.PUBLIC,
          new ClassNode(Long.class),
          null,
          null,
          null);
    }
  }
コード例 #3
0
  private void injectVersionProperty(ClassNode classNode) {
    final boolean hasVersion = /*GrailsASTUtils.*/
        hasProperty(classNode, /*GrailsDomainClassProperty.*/ VERSION);

    if (!hasVersion) {
      // if(LOG.isDebugEnabled()) {
      //    LOG.debug("[GrailsDomainInjector] Adding property [" + GrailsDomainClassProperty.VERSION
      // + "] to class [" + classNode.getName() + "]");
      // }
      classNode.addProperty(
          /*GrailsDomainClassProperty.*/ VERSION,
          Modifier.PUBLIC,
          new ClassNode(Long.class),
          null,
          null,
          null);
    }
  }