public synchronized <T> void create(String metricsName,
                                        String functionName,
                                        ScopeType type) throws IllegalArgumentException {
        final Class<? extends AcceptableValue> meterFunction = functionRegister.get(functionName);

        if (meterFunction == null) {
            throw new IllegalArgumentException("Function " + functionName + " can't be found.");
        }
        Type acceptance = null;
        for (final Type genericInterface : meterFunction.getGenericInterfaces()) {
            if (genericInterface instanceof ParameterizedType) {
                ParameterizedType parameterizedType = (ParameterizedType) genericInterface;
                if (parameterizedType.getRawType().getTypeName().equals(AcceptableValue.class.getName())) {
                    Type[] arguments = parameterizedType.getActualTypeArguments();
                    acceptance = arguments[0];
                    break;
                }
            }
        }
        try {
            create(metricsName, functionName, type, Class.forName(Objects.requireNonNull(acceptance).getTypeName()));
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    }
@Test
    public void testCreate() {
        // validate with same name, function and scope types
        meterSystem.create("test_meter", "avg", ScopeType.SERVICE);
        validateMeterDefinition("test_meter", Long.class, ScopeType.SERVICE);
        meterSystem.create("test_meter", "avg", ScopeType.SERVICE);
        validateMeterDefinition("test_meter", Long.class, ScopeType.SERVICE);

        // validate with same name, difference scope type
        try {
            meterSystem.create("test_meter", "avg", ScopeType.SERVICE_INSTANCE);
            throw new IllegalStateException();
        } catch (IllegalArgumentException e) {
            // If wrong arguments is means right
        }

        // validate with same name, difference function
        try {
            meterSystem.create("test_meter", "avgLabeled", ScopeType.SERVICE);
            throw new IllegalStateException();
        } catch (IllegalArgumentException e) {
            // If wrong arguments is means right
        }
    }