001package org.apache.archiva.redback.rest.api.model.v2; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import javax.xml.bind.annotation.XmlEnumValue; 022 023public enum GrantType 024{ 025 @XmlEnumValue( "refresh_token" ) 026 REFRESH_TOKEN("refresh_token"), 027 028 @XmlEnumValue( "authorization_code" ) 029 AUTHORIZATION_CODE("authorization_code"), 030 031 @XmlEnumValue( "none" ) 032 NONE("none"); 033 034 private final String label; 035 036 GrantType(final String label) { 037 if (label==null) { 038 throw new NullPointerException( "Label must not be null" ); 039 } 040 this.label = label; 041 } 042 043 public String getLabel() { 044 return this.label; 045 } 046 047 public static GrantType byLabel(String label) { 048 for (GrantType value : values()) { 049 if (value.getLabel().equals( label )) { 050 return value; 051 } 052 } 053 throw new IllegalArgumentException( "Label does not exist " + label ); 054 } 055 056 @Override 057 public String toString( ) 058 { 059 return this.label; 060 } 061}