HyCodeYourTale
classpublicabstractPriority 3

ValueHolder

com.hypixel.hytale.server.npc.asset.builder.holder.ValueHolder

5

Methods

5

Public Methods

3

Fields

1

Constructors

Constants

HytaleLoggerLOGGER= HytaleLogger.get("BuilderManager")
booleanLOG_VALUES= false

Constructors

protected
ValueHolder(ValueType valueType)

Methods

Public Methods (5)

public
String getExpressionString()
public
String getName()
public
boolean isStatic()
public
void setName(String name)
public
void validate(ExecutionContext var1)

Fields

Protected Fields (3)

protectedBuilderExpression expression
protectedString name
protectedValueType valueType

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.server.npc.asset.builder.holder;

import com.google.gson.JsonElement;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.npc.asset.builder.BuilderParameters;
import com.hypixel.hytale.server.npc.asset.builder.expression.BuilderExpression;
import com.hypixel.hytale.server.npc.util.expression.ExecutionContext;
import com.hypixel.hytale.server.npc.util.expression.ValueType;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public abstract class ValueHolder {
   protected static final boolean LOG_VALUES = false;
   protected static final HytaleLogger LOGGER = HytaleLogger.get("BuilderManager");
   protected ValueType valueType;
   protected String name;
   protected BuilderExpression expression;

   protected ValueHolder(ValueType valueType) {
      this.valueType = valueType;
   }

   public abstract void validate(ExecutionContext var1);

   protected void readJSON(@Nonnull JsonElement requiredJsonElement, String name, @Nonnull BuilderParameters builderParameters) {
      this.name = name;
      this.expression = BuilderExpression.fromJSON(requiredJsonElement, builderParameters, this.valueType);
   }

   protected void readJSON(
      @Nullable JsonElement optionalJsonElement, @Nonnull Supplier<BuilderExpression> defaultValue, String name, @Nonnull BuilderParameters builderParameters
   ) {
      this.name = name;
      this.expression = optionalJsonElement != null ? BuilderExpression.fromJSON(optionalJsonElement, builderParameters, this.valueType) : defaultValue.get();
   }

   public String getName() {
      return this.name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public boolean isStatic() {
      return this.expression.isStatic();
   }

   public String getExpressionString() {
      return this.expression.getExpression();
   }
}