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

com.syntaxphoenix.syntaxapi.service.ServiceFieldValue Maven / Gradle / Ivy

package com.syntaxphoenix.syntaxapi.service;

import java.lang.reflect.Field;

public class ServiceFieldValue implements IServiceValue {

    private final Object instance;
    private final Class owner;

    private final Field field;
    private final SubscribeService annotation;

    public ServiceFieldValue(Class owner, Field field) {
        this(owner, field, null);
    }

    public ServiceFieldValue(Class owner, Field field, Object instance) {
        this.owner = owner;
        this.instance = instance;

        this.field = field;
        this.annotation = field.getAnnotation(SubscribeService.class);
    }

    /*
     * 
     */

    @Override
    public Class getOwner() {
        return owner;
    }

    @Override
    public Object getOwnerInstance() {
        return instance;
    }

    /*
     * 
     */

    @Override
    public ValueType getType() {
        return ValueType.FIELD;
    }

    @Override
    public Field asField() {
        return field;
    }

    @Override
    public Field getObject() {
        return field;
    }

    @Override
    public SubscribeService getAnnotation() {
        return annotation;
    }

    @Override
    public ServicePriority getPriority() {
        return annotation.priority();
    }

    @Override
    public Class getService() {
        return annotation.service();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy