HyCodeYourTale
classpublicPriority 3

MissingAssetException

com.hypixel.hytale.assetstore.MissingAssetException

extends RuntimeException

4

Methods

4

Public Methods

2

Fields

2

Constructors

Constructors

public
MissingAssetException(String field, Class<? extends JsonAsset> assetType, Object assetId)
public
MissingAssetException(String field, Class<? extends JsonAsset> assetType, Object assetId, String extra)

Methods

Public Methods (4)

public
Object getAssetId()
public
String getField()
publicstatic
void handle(ExtraInfo extraInfo, String field, Class<? extends JsonAsset> assetType, Object assetId)
publicstatic
void handle(ExtraInfo extraInfo, String field, Class<? extends JsonAsset> assetType, Object assetId, String extra)

Fields

Private/Package Fields (2)

privateObject assetId
privateString field

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.assetstore;

import com.hypixel.hytale.codec.ExtraInfo;
import com.hypixel.hytale.codec.validation.ValidationResults;
import javax.annotation.Nonnull;

public class MissingAssetException extends RuntimeException {
   private String field;
   private Class<? extends JsonAsset> assetType;
   private Object assetId;

   public MissingAssetException(String field, @Nonnull Class<? extends JsonAsset> assetType, Object assetId) {
      super("Missing asset '" + assetId + "' of type " + assetType.getSimpleName() + " for field '" + field + "'!");
      this.field = field;
      this.assetType = assetType;
      this.assetId = assetId;
   }

   public MissingAssetException(String field, @Nonnull Class<? extends JsonAsset> assetType, Object assetId, String extra) {
      super("Missing asset '" + assetId + "' of type " + assetType.getSimpleName() + " for field '" + field + "'! " + extra);
      this.field = field;
      this.assetType = assetType;
      this.assetId = assetId;
   }

   public String getField() {
      return this.field;
   }

   public Class<? extends JsonAsset> getAssetType() {
      return this.assetType;
   }

   public Object getAssetId() {
      return this.assetId;
   }

   public static void handle(@Nonnull ExtraInfo extraInfo, String field, @Nonnull Class<? extends JsonAsset> assetType, Object assetId) {
      ValidationResults validationResults = extraInfo.getValidationResults();
      if (validationResults instanceof AssetValidationResults) {
         ((AssetValidationResults)validationResults).handleMissingAsset(field, assetType, assetId);
      } else {
         throw new MissingAssetException(field, assetType, assetId);
      }
   }

   public static void handle(@Nonnull ExtraInfo extraInfo, String field, @Nonnull Class<? extends JsonAsset> assetType, Object assetId, String extra) {
      ValidationResults validationResults = extraInfo.getValidationResults();
      if (validationResults instanceof AssetValidationResults) {
         ((AssetValidationResults)validationResults).handleMissingAsset(field, assetType, assetId, extra);
      } else {
         throw new MissingAssetException(field, assetType, assetId, extra);
      }
   }
}