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

org.simpleflatmapper.reflect.meta.NonMappedPropertyMeta 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: 9.0.2
Show newest version
package org.simpleflatmapper.reflect.meta;

import org.simpleflatmapper.reflect.*;
import org.simpleflatmapper.reflect.getter.NullGetter;
import org.simpleflatmapper.reflect.setter.NullSetter;

import java.lang.reflect.Type;

public class NonMappedPropertyMeta extends PropertyMeta {

	private final Type type;
	private final Object[] defineProperties;

	public NonMappedPropertyMeta(
			String name,
			Type ownerType,
			ReflectionService reflectService,
			Object[] defineProperties) {

		super(cleanUpName(name), ownerType, reflectService);
		this.type = Object.class;
		this.defineProperties = defineProperties;
	}

	private static String cleanUpName(String name) {
		int i = 0;
		while(i < name.length() && DefaultPropertyNameMatcher._isSeparatorChar(name.charAt(i)))
			i++;

		return i > 0 ? name.substring(i) : name;
	}

	@Override
	public PropertyMeta withReflectionService(ReflectionService reflectionService) {
		return new NonMappedPropertyMeta(getName(), getOwnerType(), reflectionService, defineProperties);
	}

	@Override
	public Setter getSetter() {
		return NullSetter.NULL_SETTER;
	}

    @Override
    public Getter getGetter() {
        return NullGetter.getter();
    }

    @Override
	public Type getPropertyType() {
		return type;
	}

	@Override
	public String getPath() {
		return getName();
	}

	@Override
	public Object[] getDefinedProperties() {
		return defineProperties;
	}

	public boolean isNonMapped() {
		return true;
	}

	@Override
	public PropertyMeta toNonMapped() {
		throw new UnsupportedOperationException();
	}

	@Override
    public String toString() {
        return "NonMappedPropertyMeta{" +
                "name="+ getName() +
                '}';
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy