All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unidal.eunit.model.entity.EunitField Maven / Gradle / Ivy

/* THIS FILE WAS AUTO GENERATED BY codegen-maven-plugin, DO NOT EDIT IT */
package org.unidal.eunit.model.entity;

import static org.unidal.eunit.model.Constants.ATTR_NAME;
import static org.unidal.eunit.model.Constants.ENTITY_EUNIT_FIELD;

import java.util.ArrayList;
import java.util.List;

import org.unidal.eunit.model.BaseEntity;
import org.unidal.eunit.model.IVisitor;

public class EunitField extends BaseEntity {
   private String m_name;

   private Class m_type;

   private transient java.lang.reflect.Field m_field;

   private transient EunitClass m_eunitClass;

   private transient List m_annotations = new ArrayList();

   public EunitField() {
   }

   public EunitField(String name) {
      m_name = name;
   }

   @Override
   public void accept(IVisitor visitor) {
      visitor.visitEunitField(this);
   }

   public EunitField addAnnotation(java.lang.annotation.Annotation annotation) {
      m_annotations.add(annotation);
      return this;
   }

   @Override
   public boolean equals(Object obj) {
      if (obj instanceof EunitField) {
         EunitField _o = (EunitField) obj;

         if (!equals(getName(), _o.getName())) {
            return false;
         }

         return true;
      }

      return false;
   }

   @SuppressWarnings("unchecked")
   public  T findAnnotation(Class clazz) {
      for (java.lang.annotation.Annotation annotation : m_annotations) {
         if (annotation.annotationType() == clazz) {
            return (T) annotation;
         }
      }

      return null;
   }

   public List getAnnotations() {
      return m_annotations;
   }

   public EunitClass getEunitClass() {
      return m_eunitClass;
   }

   public java.lang.reflect.Field getField() {
      return m_field;
   }

   public String getName() {
      return m_name;
   }

   public Class getType() {
      return m_type;
   }

   @Override
   public int hashCode() {
      int hash = 0;

      hash = hash * 31 + (m_name == null ? 0 : m_name.hashCode());

      return hash;
   }

   public boolean isAnnotationPresent(Class clazz) {
      return findAnnotation(clazz) != null;
   }

   @Override
   public void mergeAttributes(EunitField other) {
      assertAttributeEquals(other, ENTITY_EUNIT_FIELD, ATTR_NAME, m_name, other.getName());

      if (other.getType() != null) {
         m_type = other.getType();
      }

      if (other.getField() != null) {
         m_field = other.getField();
      }

      if (other.getEunitClass() != null) {
         m_eunitClass = other.getEunitClass();
      }
   }

   public EunitField setEunitClass(EunitClass eunitClass) {
      m_eunitClass = eunitClass;
      return this;
   }

   public EunitField setField(java.lang.reflect.Field field) {
      m_field = field;
      return this;
   }

   public EunitField setName(String name) {
      m_name = name;
      return this;
   }

   public EunitField setType(Class type) {
      m_type = type;
      return this;
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy