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

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

package com.syntaxphoenix.syntaxapi.service;

import java.lang.reflect.Method;

public class ServiceMethodValue implements IServiceValue {
	
	private final Object instance;
	private final Class owner;
	
	private final Method method;
	private final SubscribeService annotation;
	
	public ServiceMethodValue(Class owner, Method method) {
		this(owner, method, null);
	}
	
	public ServiceMethodValue(Class owner, Method method, Object instance) {
		this.owner = owner;
		this.instance = instance;
		
		this.method = method;
		this.annotation = method.getAnnotation(SubscribeService.class);
	}
	
	/*
	 * 
	 */
	
	@Override
	public Class getOwner() {
		return owner;
	}
	
	@Override
	public Object getOwnerInstance() {
		return instance;
	}
	
	/*
	 * 
	 */
	
	@Override
	public ValueType getType() {
		return ValueType.METHOD;
	}
	
	@Override
	public Method asMethod() {
		return method;
	}
	
	@Override
	public Method getObject() {
		return method;
	}
	
	@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