mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 19:20:44 +02:00
This change renames directories in preparation for the great package rename. The repository is now in a broken state because the code itself hasn't been updated. However this should ensure that git correctly preserves history for each file.
86 lines
2.2 KiB
Java
86 lines
2.2 KiB
Java
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
|
//
|
|
// Licensed 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 com.google.domain.registry.model.domain.fee;
|
|
|
|
import static com.google.common.base.MoreObjects.firstNonNull;
|
|
|
|
import com.google.domain.registry.model.ImmutableObject;
|
|
import com.google.domain.registry.xml.PeriodAdapter;
|
|
|
|
import org.joda.time.Period;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import javax.xml.bind.annotation.XmlAttribute;
|
|
import javax.xml.bind.annotation.XmlEnumValue;
|
|
import javax.xml.bind.annotation.XmlTransient;
|
|
import javax.xml.bind.annotation.XmlValue;
|
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|
|
|
/** Base class for the fee and credit types. */
|
|
@XmlTransient
|
|
public class BaseFee extends ImmutableObject {
|
|
|
|
/** Enum for when a fee is applied. */
|
|
public enum AppliedType {
|
|
@XmlEnumValue("immediate")
|
|
IMMEDIATE,
|
|
|
|
@XmlEnumValue("delayed")
|
|
DELAYED
|
|
}
|
|
|
|
@XmlAttribute
|
|
String description;
|
|
|
|
@XmlAttribute
|
|
AppliedType applied;
|
|
|
|
@XmlAttribute(name = "grace-period")
|
|
@XmlJavaTypeAdapter(PeriodAdapter.class)
|
|
Period gracePeriod;
|
|
|
|
@XmlAttribute
|
|
Boolean refundable;
|
|
|
|
@XmlValue
|
|
BigDecimal cost;
|
|
|
|
public String getDescription() {
|
|
return description;
|
|
}
|
|
|
|
public AppliedType getApplied() {
|
|
return firstNonNull(applied, AppliedType.IMMEDIATE);
|
|
}
|
|
|
|
public Period getGracePeriod() {
|
|
return firstNonNull(gracePeriod, Period.ZERO);
|
|
}
|
|
|
|
public Boolean getRefundable() {
|
|
return firstNonNull(refundable, true);
|
|
}
|
|
|
|
public BigDecimal getCost() {
|
|
return cost;
|
|
}
|
|
|
|
public boolean hasDefaultAttributes() {
|
|
return getGracePeriod().equals(Period.ZERO)
|
|
&& getApplied().equals(AppliedType.IMMEDIATE)
|
|
&& getRefundable();
|
|
}
|
|
}
|