org.simpleflatmapper.reflect.meta.NonMappedPropertyMeta Maven / Gradle / Ivy
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() +
'}';
}
}