mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
[ISSUE #3949] Remove unused class
This commit is contained in:
@@ -42,6 +42,5 @@ public class TopicAttributes {
|
||||
static {
|
||||
ALL = new HashMap<>();
|
||||
ALL.put(QUEUE_TYPE_ATTRIBUTE.getName(), QUEUE_TYPE_ATTRIBUTE);
|
||||
ALL.put(TOPIC_MESSAGE_TYPE_ATTRIBUTE.getName(), TOPIC_MESSAGE_TYPE_ATTRIBUTE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.rocketmq.common.attribute;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
public abstract class AbstractRangeAttribute<T extends Comparable<T>> extends Attribute {
|
||||
|
||||
protected final T min;
|
||||
protected final T max;
|
||||
protected final T defaultValue;
|
||||
|
||||
public AbstractRangeAttribute(String name, boolean changeable, T min, T max, T defaultValue) {
|
||||
super(name, changeable);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
protected abstract T parse(String value);
|
||||
|
||||
@Override
|
||||
public void verify(String value) {
|
||||
T l = parse(value);
|
||||
if (l.compareTo(min) < 0 || l.compareTo(max) > 0) {
|
||||
throw new RuntimeException(format("value is not in range(%s, %s)", min, max));
|
||||
}
|
||||
}
|
||||
|
||||
public T getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.rocketmq.common.attribute;
|
||||
|
||||
public class IntRangeAttribute extends AbstractRangeAttribute<Integer> {
|
||||
|
||||
public IntRangeAttribute(String name, boolean changeable, int min, int max, int defaultValue) {
|
||||
super(name, changeable, min, max, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer parse(String value) {
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,29 @@
|
||||
*/
|
||||
package org.apache.rocketmq.common.attribute;
|
||||
|
||||
public class LongRangeAttribute extends AbstractRangeAttribute<Long> {
|
||||
import static java.lang.String.format;
|
||||
|
||||
public class LongRangeAttribute extends Attribute {
|
||||
private final long min;
|
||||
private final long max;
|
||||
private final long defaultValue;
|
||||
|
||||
public LongRangeAttribute(String name, boolean changeable, long min, long max, long defaultValue) {
|
||||
super(name, changeable, min, max, defaultValue);
|
||||
super(name, changeable);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Long parse(String value) {
|
||||
return Long.parseLong(value);
|
||||
public void verify(String value) {
|
||||
long l = Long.parseLong(value);
|
||||
if (l < min || l > max) {
|
||||
throw new RuntimeException(format("value is not in range(%d, %d)", min, max));
|
||||
}
|
||||
}
|
||||
|
||||
public long getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.rocketmq.common.constant;
|
||||
|
||||
public class TopicMessageTypeName {
|
||||
public static final int INDEX_TRANSACTION = 4;
|
||||
public static final int INDEX_DELAY = 3;
|
||||
public static final int INDEX_FIFO = 2;
|
||||
public static final int INDEX_NORMAL = 1;
|
||||
|
||||
public static final int TRANSACTION = 0x1 << INDEX_TRANSACTION;
|
||||
public static final int DELAY = 0x1 << INDEX_DELAY;
|
||||
public static final int FIFO = 0x1 << INDEX_FIFO;
|
||||
public static final int NORMAL = 0x1 << INDEX_NORMAL;
|
||||
public static final int UNSPECIFIED = 0;
|
||||
|
||||
public static final int ALL = NORMAL | FIFO | DELAY | TRANSACTION;
|
||||
|
||||
public static boolean isUnspecified(final int type) {
|
||||
return type == UNSPECIFIED;
|
||||
}
|
||||
|
||||
public static boolean isNormal(final int type) {
|
||||
return (type & NORMAL) == NORMAL;
|
||||
}
|
||||
|
||||
public static boolean isFifo(final int type) {
|
||||
return (type & FIFO) == FIFO;
|
||||
}
|
||||
|
||||
public static boolean isDelay(final int type) {
|
||||
return (type & DELAY) == DELAY;
|
||||
}
|
||||
|
||||
public static boolean isTransaction(final int type) {
|
||||
return (type & TRANSACTION) == TRANSACTION;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user