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

com.dulanywebsite.sharedresources.entities.Connection.Game.SecretSanta.Gift Maven / Gradle / Ivy

package com.dulanywebsite.sharedresources.entities.Connection.Game.SecretSanta;

import com.dulanywebsite.sharedresources.entities.DuWebEntity;
import com.dulanywebsite.sharedresources.exceptions.InvalidEntityException;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.cloud.gcp.data.datastore.core.mapping.Entity;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@Entity(name = "gift")
public class Gift extends DuWebEntity {
    private String name;

    private String link;

    private String picUrl;

    private Boolean isBought;

    private Long gameMembership;

    @Override
    protected void ValidateSub() throws InvalidEntityException {
        if (name == null || gameMembership == null) {
            throw new InvalidEntityException(this.getClass().toString() + " class has a null value that shouldn't be null");
        }
    }

    @Override
    public void UpdateEntity(String propertyName, Object updateValue) throws NoSuchFieldException, IllegalAccessException {
        if (propertyName.equals("id")) {
            throw new IllegalArgumentException("This property cannot be updated: " + propertyName);
        }
        getClass().getDeclaredField(propertyName).set(this, updateValue);
    }

    @Override
    public void AddItem(String propertyName, Object addValue) {
        throw new IllegalArgumentException("This class doesn't have a property to add to");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy