/*
 * Unique Schlüssel für JPA Entität
 */
package de.ivu.elect.business.geodata.entity;
import java.util.function.Function;
import java.util.ArrayList;
import java.util.stream.Collectors;

@javax.enterprise.inject.Vetoed
public class GeodataPlzUK
implements de.ivu.elect.jee.entity.tk.EntityUK, java.io.Serializable
  {

  private static final long serialVersionUID = 1L;

    protected final java.lang.String plz;

    public java.lang.String getPlz(){
      return plz;
    }


  public GeodataPlzUK(
java.lang.String plz
  ) {
    super();


      this.plz = plz;
      }

  @Override
  public int hashCode() {
        int result = 1;
    
    
                    result = result + ((plz == null) ? 0 : plz.hashCode());
        
            
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (obj == null) {
      return false;
    }

    
    if (getClass() != obj.getClass()) {
      return false;
    }

            GeodataPlzUK other = (GeodataPlzUK) obj;

                if (plz == null) {
          if (other.plz != null) {
            return false;
          }
        } else if (!plz.equals(other.plz)) {
          return false;
        }
        
            
    return true;
  }

  @Override
  public String getEntityMessageKey() {
    return GeodataPlzConstants.MESSAGE_KEY_ENTITY_EINZAHL;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getAllEntityFieldValues() {
    java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

    result.addAll(getEntityFieldValuesForEntity());
    return result;
  }

  @Override
  public java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> getEntityFieldValuesForEntity() {
            java.util.List<de.ivu.elect.jee.entity.tk.EntityFieldValue> result = new java.util.ArrayList<>();

                    result.add(new de.ivu.elect.jee.entity.tk.EntityFieldValue(GeodataPlzConstants.MESSAGE_KEY_ENTITY_EINZAHL, GeodataPlzConstants.MESSAGE_KEY_PLZ_EINZAHL, plz));
        
        return result;
      }
  
    @Override
  public String toString() {
    return "GeodataPlzUK[" + toStringParameter() + "]";
  }

            protected String toStringParameter() {
              String result = ""

                                                        +"plz="+plz
                                    ;
                          return result;
            
            }




          public String allUKFields() {
    return String.join(", ", getAllUKFieldValues().stream()
         .map(object -> (object != null ? object.toString() : null))
         .collect(Collectors.toList()));
    }

   protected ArrayList<Object> getAllUKFieldValues() {
              ArrayList<Object> list = new ArrayList<>();
              list.add(plz);
     return list;
   }

            public static <E extends GeodataPlz> java.util.Map<GeodataPlzUK, E> mappeGeodataPlzNachUK(java.util.Collection<E> entities) {

                return entities.stream().collect(java.util.stream.Collectors.toMap(GeodataPlz::getGeodataPlzUK, Function.<E>identity(), (u,v)->v));
             }


                public static Function<GeodataPlz, GeodataPlzUK> getGeodataPlzToUKFunction() {
                return GeodataPlz::getGeodataPlzUK;
                }

}
