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

org.sfm.reflect.meta.SubPropertyMeta Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.reflect.meta;

import org.sfm.reflect.Getter;
import org.sfm.reflect.ReflectionService;
import org.sfm.reflect.Setter;

import java.lang.reflect.Type;

public class SubPropertyMeta extends PropertyMeta {
	private final PropertyMeta ownerProperty;
	private final PropertyMeta subProperty;
	
	public SubPropertyMeta(ReflectionService reflectService, PropertyMeta property, PropertyMeta subProperty) {
		super(property.getName(), reflectService);
		this.ownerProperty = property;
		this.subProperty = subProperty;
	}
	@Override
	protected Setter newSetter() {
		return ownerProperty.newSetter();
	}

    @Override
    protected Getter newGetter() {
        return ownerProperty.newGetter();
    }

    @Override
	public Type getType() {
		return ownerProperty.getType();
	}
	public PropertyMeta getOwnerProperty() {
		return ownerProperty;
	}
	public PropertyMeta getSubProperty() {
		return subProperty;
	}
	@Override
	protected ClassMeta

newClassMeta() { return ownerProperty.getClassMeta(); } @Override public boolean isSubProperty() { return true; } @Override public String getPath() { return getOwnerProperty().getPath() + "." + subProperty.getPath(); } @SuppressWarnings("unchecked") public Type getLeafType() { if (subProperty.isSubProperty()) { return ((SubPropertyMeta)subProperty).getLeafType(); } else { return subProperty.getType(); } } @Override public String toString() { return "SubPropertyMeta{" + "ownerProperty=" + ownerProperty + ", subProperty=" + subProperty + '}'; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy