001package com.nimbusds.jose; 002 003 004/** 005 * Handler of parsed {@link JOSEObject}s. Invoked by the 006 * {@link JOSEObject#parse(String,JOSEObjectHandler)} method 007 * to indicate the exact type of the parsed object - {@link PlainObject plain}, 008 * {@link JWSObject signed} or {@link JWEObject encrypted object}. 009 * 010 * @since 3.4 011 */ 012public interface JOSEObjectHandler<T> { 013 014 015 /** 016 * Invoked when the parsed JOSE object is plain (unsecured). 017 * 018 * @param plainObject The parsed plain JOSE object. Not {@code null}. 019 * 020 * @return Any object to be used after inspecting the plain JOSE 021 * object, or {@code null} if no return value is necessary. 022 */ 023 public T onPlainObject(final PlainObject plainObject); 024 025 026 /** 027 * Invoked when the the parsed JOSE object is a JWS object. 028 * 029 * @param jwsObject The parsed JWS object. Not {@code null}. 030 * 031 * @return Any object to be used after inspecting the JWS object, or 032 * {@code null} if no return value is necessary. 033 */ 034 public T onJWSObject(final JWSObject jwsObject); 035 036 037 /** 038 * Invoked when the parsed JOSE object is a JWE object. 039 * 040 * @param jweObject The parsed JWE object. Not {@code null}. 041 * 042 * @return Any object to be used after inspecting the JWE object, or 043 * {@code null} if no return value is necessary. 044 */ 045 public T onJWEObject(final JWEObject jweObject); 046} 047