001package com.nimbusds.oauth2.sdk.token;
002
003
004import net.jcip.annotations.Immutable;
005import net.minidev.json.JSONObject;
006
007import java.util.Set;
008
009
010/**
011 * Typeless (generic) token.
012 */
013@Immutable
014public class TypelessToken extends Token {
015        
016        
017        private static final long serialVersionUID = 1477117093355749547L;
018        
019        
020        /**
021         * Creates a new typeless token with the specified value.
022         *
023         * @param value The token value. Must not be {@code null} or empty
024         *              string.
025         */
026        public TypelessToken(final String value) {
027                super(value);
028        }
029        
030        
031        @Override
032        public Set<String> getParameterNames() {
033                return getCustomParameters().keySet();
034        }
035        
036        
037        @Override
038        public JSONObject toJSONObject() {
039                JSONObject jsonObject = new JSONObject();
040                jsonObject.putAll(getCustomParameters());
041                return jsonObject;
042        }
043}