All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.idsec.signservice.integration.document.ProcessedTbsDocument Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2019-2023 IDsec Solutions AB
 *
 * 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 se.idsec.signservice.integration.document;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import lombok.Getter;

/**
 * Representation of a "processed" TBS document. This is basically the {@link TbsDocument} instance and its document
 * object (as a Java object).
 *
 * @author Martin Lindström ([email protected])
 * @author Stefan Santesson ([email protected])
 */
public class ProcessedTbsDocument {

  /** The TbsDocument. */
  @Getter
  private final TbsDocument tbsDocument;

  /** The document as a Java object. */
  @Getter
  private final Object documentObject;

  /**
   * Constructor.
   *
   * @param tbsDocument the TbsDocument
   * @param documentObject the document as a Java object
   */
  public ProcessedTbsDocument(@Nonnull final TbsDocument tbsDocument, @Nullable final Object documentObject) {
    this.tbsDocument = tbsDocument;
    this.documentObject = documentObject;
  }

  /**
   * Gets the document object.
   *
   * @param type the required type
   * @param  the type
   * @return the document object or null
   */
  public  T getDocumentObject(final Class type) {
    return this.documentObject != null ? type.cast(this.documentObject) : null;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy