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

org.whaka.util.reflection.properties.ClassProperty Maven / Gradle / Ivy

package org.whaka.util.reflection.properties;

import java.lang.reflect.ParameterizedType;

import org.whaka.util.reflection.Visibility;

public interface ClassProperty {

	ClassPropertyKey getKey();

	Class getType();
	
	default ParameterizedType getGenericType() {
		return null;
	}
	
	Visibility getVisibility();

	boolean isStatic();
	
	/**
	 * If {@link #isStatic()} returns true - specified target is ignored and may be null
	 * @throws IllegalArgumentException if target is not an instance of the declaring class from the property key
	 */
	Type getValue(TargetType target) throws Exception;
	
	/**
	 * If {@link #isStatic()} returns true - specified target is ignored and may be null
	 * @throws UnsupportedOperationException if {@link #isMutable()} returns false
	 * @throws IllegalArgumentException if target is not an instance of the declaring class from the property key
	 * @throws IllegalArgumentException if value of an illegal type is specified
	 */
	default void setValue(TargetType target, Type value) throws Exception {
		throw new UnsupportedOperationException();
	}
	
	/**
	 * If this method returns true - {@link #setValue(Object, Object)} can be called
	 */
	default boolean isMutable() {
		return false;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy