将对象以指定资源名和类型注入到资源池中

@param <A>      泛型
@param autoSync 是否同步已被注入的资源
@param name     资源名
@param clazz    资源类型
@param rs       资源对象

@return 旧资源对象
547002
public <A> A register(final boolean autoSync, final String name, final Type clazz, final A rs) {
        checkResourceName(name);
        ConcurrentHashMap<String, ResourceEntry> map = this.store.get(clazz);
        if (map == null) {
            synchronized (clazz) {
                map = this.store.get(clazz);
                if (map == null) {
                    map = new ConcurrentHashMap();
                    store.put(clazz, map);
                }
            }
        }
        ResourceEntry re = map.get(name);
        if (re == null) {
            map.put(name, new ResourceEntry(rs));
        } else {
            map.put(name, new ResourceEntry(rs, name, re.elements, autoSync));
        }
        return re == null ? null : (A) re.value;
    }
90499
public synchronized Object get(Object name)
    {
        if (_initParams==null)
            return null;
        return _initParams.get(name);
    }
86262
public <A> A register(final String name, final Type clazz, final A rs) {
        return register(true, name, clazz, rs);
    }
847934
public static List<Object> getList(String name){
        if(getConfiguration().containsKey(name)){
            return getConfiguration().getList(name);
        }
        return null;
    }
926863
protected final <T> T[] getIds(String name, Class<T> clazz) {
    T[] datas = Params.getAll(name + ".id", clazz);
    if (null == datas) {
      String datastring = Params.get(name + ".ids");
      if (null == datastring) datastring = Params.get(name + "Ids");
      if (null == datastring) Array.newInstance(clazz, 0);
      else return Params.converter.convert(Strings.split(datastring, ","), clazz);
    }
    return datas;
  }
1116726
public String getCppName(Class<?> clazz) {
        ClassMapping mapping = mappingCache.get(clazz);
        Java4Cpp annotation = clazz.getAnnotation(Java4Cpp.class);

        if (mapping != null) {
            if (!Utils.isNullOrEmpty(mapping.getCppName())) {
                return mapping.getCppName();
            }
        }
        if (annotation != null && !Utils.isNullOrEmpty(annotation.name())) {
            return annotation.name();
        }
        return escapeName(clazz.getSimpleName());
    }
33223
public <T extends AbstractSchemaProperty> T get(final Class<T> clazz, final String name) {
        Set<T> propertyCollection = get(clazz);
        for (T property : propertyCollection) {
            if (property.getName().equals(name)) {
                return property;
            }
        }
        return null;
    }
138864
public void configureFactory(Class<?> clazz) {
        ConnectionConfiguration connectionConfiguration = resolveConnectionConfiguration(clazz);
        if (connectionConfiguration == null) {
            return;
        }
        connectionFactory.setHost(connectionConfiguration.host());
        connectionFactory.setVirtualHost(connectionConfiguration.virtualHost());
        connectionFactory.setPort(connectionConfiguration.port());
        connectionFactory.setConnectionTimeout(connectionConfiguration.timeout());
        connectionFactory.setRequestedHeartbeat(connectionConfiguration.heartbeat());
        connectionFactory.setUsername(connectionConfiguration.username());
        connectionFactory.setPassword(connectionConfiguration.password());
        connectionFactory.setRequestedFrameMax(connectionConfiguration.frameMax());
    }
697283
public <A> A register(final boolean autoSync, final Class<? extends A> clazz, final A rs) {
        return register(autoSync, "", clazz, rs);
    }
513220
public boolean noteTransition (Class<?> clazz, final String name)
        throws PersistenceException
    {
        final String cname = clazz.getName();
        return executeUpdate(new Operation<Boolean>() {
            public Boolean invoke (Connection conn, DatabaseLiaison liaison)
                throws SQLException, PersistenceException
            {
                PreparedStatement stmt = null;
                try {
                    stmt = conn.prepareStatement(
                        "insert into " + liaison.tableSQL("TRANSITIONS") + " (" +
                        liaison.columnSQL("CLASS") + ", " + liaison.columnSQL("NAME") +
                        ", " + liaison.columnSQL("APPLIED") +
                        ") values (?, ?, ?)");
                    stmt.setString(1, cname);
                    stmt.setString(2, name);
                    stmt.setTimestamp(3, new Timestamp(System.currentTimeMillis()));
                    JDBCUtil.checkedUpdate(stmt, 1);
                    return true;

                } catch (SQLException sqe) {
                    if (liaison.isDuplicateRowException(sqe)) {
                        return false;
                    } else {
                        throw sqe;
                    }

                } finally {
                    JDBCUtil.close(stmt);
                }
            }
        });
    }
190388
@CallerSideMethod
    public RealLiveTable tbl(String name ) {
        return (RealLiveTable) getActor().syncTableAccess.get(name);
    }
679418
public static Method getMethod(Class<?> clazz, String name, boolean withParameters) {
        if (clazz == Object.class || clazz == null) {
            return null;
        }

        try {
            // first try without parameters
            Method method = clazz.getDeclaredMethod(name);
            return method;
        } catch (SecurityException e) {
            throw new IllegalStateException(e);
        } catch (NoSuchMethodException e) {
            if (withParameters) {
                Method[] methods = getMethods(clazz);
                for (Method method : methods) {
                    if (name.equals(method.getName())) {
                        return method;
                    }
                }
                return null;
            }
            return getMethod(clazz.getSuperclass(), name, withParameters);
        }
    }
230111
@Override
    public T get(final String _name)
    {
        if (!hasEntries()) {
            initialize(AbstractAutomaticCache.class);
        }
        return getCache4Name().get(_name);
    }
333635
protected final <T> T getId(String name, Class<T> clazz) {
    Object[] entityIds = getAll(name + ".id");
    if (Arrays.isEmpty(entityIds)) entityIds = getAll(name + "Id");
    if (Arrays.isEmpty(entityIds)) entityIds = getAll("id");
    if (Arrays.isEmpty(entityIds)) return null;
    else {
      String entityId = entityIds[0].toString();
      int commaIndex = entityId.indexOf(',');
      if (commaIndex != -1) entityId = entityId.substring(0, commaIndex);
      return Params.converter.convert(entityId, clazz);
    }
  }
297561
public <T> T getProperty(final String name, final Class<T> clazz) {
        if (containsProperty(name)) {
            val item = this.properties.get(name);
            if (item == null) {
                return null;
            }
            if (!clazz.isAssignableFrom(item.getClass())) {
                throw new ClassCastException("Object [" + item + " is of type " + item.getClass() + " when we were expecting " + clazz);
            }
            return (T) item;
        }
        return null;
    }
272360
public static String createThreadName(String hzName, String name) {
        checkNotNull(name, "name can't be null");
        return "hz." + hzName + "." + name;
    }
947965
public void clearTransition (Class<?> clazz, final String name)
        throws PersistenceException
    {
        final String cname = clazz.getName();
        executeUpdate(new Operation<Void>() {
            public Void invoke (Connection conn, DatabaseLiaison liaison)
                throws SQLException, PersistenceException
            {
                PreparedStatement stmt = null;
                try {
                    stmt = conn.prepareStatement(
                        " delete from " + liaison.tableSQL("TRANSITIONS") +
                        "       where " + liaison.columnSQL("CLASS") + "=? " +
                        "         and " + liaison.columnSQL("NAME") + "=?");
                    stmt.setString(1, cname);
                    stmt.setString(2, name);
                    stmt.executeUpdate(); // we don't care if it worked or not

                } finally {
                    JDBCUtil.close(stmt);
                }
                return null;
            }
        });
    }