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

com.gitee.jmash.propertyset.PropSetFactory Maven / Gradle / Ivy

There is a newer version: 0.0.3
Show newest version

package com.gitee.jmash.propertyset;

import com.gitee.jmash.propertyset.service.PropertySetRead;
import com.gitee.jmash.propertyset.service.PropertySetReadBean;
import com.gitee.jmash.propertyset.service.PropertySetWrite;
import com.gitee.jmash.propertyset.service.PropertySetWriteBean;
import jakarta.enterprise.inject.spi.CDI;

public class PropSetFactory {

  public static PropertySetRead getPropSetRead(String entityName, String key) {
    PropertySetRead p = CDI.current().select(PropertySetRead.class).get();
    if (p instanceof PropertySetReadBean) {
      ((PropertySetReadBean) p).setEntityName(entityName);
      ((PropertySetReadBean) p).setEntityId(key);
    }
    return p;
  }

  public static PropertySetWrite getPropSetWrite(String entityName, String key) {
    PropertySetWrite p = CDI.current().select(PropertySetWrite.class).get();
    if (p instanceof PropertySetWriteBean) {
      ((PropertySetWriteBean) p).setEntityName(entityName);
      ((PropertySetWriteBean) p).setEntityId(key);
    }
    return p;
  }

  public static void destroy(Object instance) {
    CDI.current().destroy(instance);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy