1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.id; 18 19 /** 20 * Abstract superclass for LongIdentifierGenerator implementations. 21 * 22 * @author Commons-Id team 23 * @version $Id: AbstractLongIdentifierGenerator.java 480488 2006-11-29 08:57:26Z bayard $ 24 */ 25 public abstract class AbstractLongIdentifierGenerator implements LongIdentifierGenerator { 26 27 /** 28 * Constructor. 29 */ 30 protected AbstractLongIdentifierGenerator() { 31 super(); 32 } 33 34 /** 35 * Returns the maximum value of an identifier from this generator. 36 * 37 * <p>The default implementation returns Long.MAX_VALUE. Implementations 38 * whose identifiers are bounded below Long.MAX_VALUE should override this method to 39 * return the maximum value of a generated identifier.</p> 40 * 41 * @return {@inheritDoc} 42 */ 43 public long maxValue() { 44 return Long.MAX_VALUE; 45 } 46 47 /** 48 * Returns the minimum value of an identifier from this generator. 49 * 50 * <p>The default implementation returns Long.MIN_VALUE. Implementations 51 * whose identifiers are bounded above Long.MIN_VALUE should override this method to 52 * return the minimum value of a generated identifier.</p> 53 * 54 * @return {@inheritDoc} 55 */ 56 public long minValue() { 57 return Long.MIN_VALUE; 58 } 59 60 public Object nextIdentifier() { 61 return this.nextLongIdentifier(); 62 } 63 64 public abstract Long nextLongIdentifier(); 65 }