package com.breeze.save; import java.beans.PropertyDescriptor; import com.breeze.metadata.AutoGeneratedKeyType; import com.breeze.util.Assert; import com.breeze.util.TypeFns; public class AutoGeneratedKey { public Object entity; public AutoGeneratedKeyType type; public String propertyName; public Object tempValue; public Object realValue; private PropertyDescriptor propertyDescriptor; public AutoGeneratedKey(Object entity, String propertyName, String autoGeneratedKeyType) { Assert.notNull(entity, "entity"); Assert.notNull(propertyName, "propertyName"); Assert.notNull(autoGeneratedKeyType, "autoGeneratedKeyType"); this.entity = entity; this.propertyName = propertyName; this.type = AutoGeneratedKeyType.valueOf(autoGeneratedKeyType); } public PropertyDescriptor getPropertyDescriptor() { if (propertyDescriptor == null) { propertyDescriptor = TypeFns.findPropertyDescriptor(entity.getClass(), propertyName); } return propertyDescriptor; } }