本文整理汇总了Java中org.hibernate.property.Getter类的典型用法代码示例。如果您正苦于以下问题:Java Getter类的具体用法?Java Getter怎么用?Java Getter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Getter类属于org.hibernate.property包,在下文中一共展示了Getter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildProxyFactory
import org.hibernate.property.Getter; //导入依赖的package包/类
@Override
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
ProxyFactory pf = new MapProxyFactory();
try {
//TODO: design new lifecycle for ProxyFactory
pf.postInstantiate(
getEntityName(),
null,
null,
null,
null,
null
);
}
catch ( HibernateException he ) {
LOG.unableToCreateProxyFactory( getEntityName(), he );
pf = null;
}
return pf;
}
示例2: AbstractComponentTuplizer
import org.hibernate.property.Getter; //导入依赖的package包/类
protected AbstractComponentTuplizer(Component component) {
propertySpan = component.getPropertySpan();
getters = new Getter[propertySpan];
setters = new Setter[propertySpan];
Iterator iter = component.getPropertyIterator();
boolean foundCustomAccessor=false;
int i = 0;
while ( iter.hasNext() ) {
Property prop = ( Property ) iter.next();
getters[i] = buildGetter( component, prop );
setters[i] = buildSetter( component, prop );
if ( !prop.isBasicPropertyAccessor() ) {
foundCustomAccessor = true;
}
i++;
}
hasCustomAccessors = foundCustomAccessor;
instantiator = buildInstantiator( component );
}
示例3: setProperties
import org.hibernate.property.Getter; //导入依赖的package包/类
public Query setProperties(Object bean) throws HibernateException {
Class clazz = bean.getClass();
String[] params = getNamedParameters();
for (int i = 0; i < params.length; i++) {
String namedParam = params[i];
try {
Getter getter = ReflectHelper.getGetter( clazz, namedParam );
Class retType = getter.getReturnType();
final Object object = getter.get( bean );
if ( Collection.class.isAssignableFrom( retType ) ) {
setParameterList( namedParam, ( Collection ) object );
}
else if ( retType.isArray() ) {
setParameterList( namedParam, ( Object[] ) object );
}
else {
setParameter( namedParam, object, determineType( namedParam, retType ) );
}
}
catch (PropertyNotFoundException pnfe) {
// ignore
}
}
return this;
}
示例4: buildProxyFactory
import org.hibernate.property.Getter; //导入依赖的package包/类
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
ProxyFactory pf = new MapProxyFactory();
try {
//TODO: design new lifecycle for ProxyFactory
pf.postInstantiate(
getEntityName(),
null,
null,
null,
null,
null
);
}
catch ( HibernateException he ) {
log.warn( "could not create proxy factory for:" + getEntityName(), he );
pf = null;
}
return pf;
}
示例5: buildProxyFactory
import org.hibernate.property.Getter; //导入依赖的package包/类
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
HashSet proxyInterfaces = new HashSet();
proxyInterfaces.add( HibernateProxy.class );
proxyInterfaces.add( Element.class );
ProxyFactory pf = new Dom4jProxyFactory();
try {
pf.postInstantiate(
getEntityName(),
Element.class,
proxyInterfaces,
null,
null,
mappingInfo.hasEmbeddedIdentifier() ?
(AbstractComponentType) mappingInfo.getIdentifier().getType() :
null
);
}
catch ( HibernateException he ) {
log.warn( "could not create proxy factory for:" + getEntityName(), he );
pf = null;
}
return pf;
}
示例6: getVersionGetter
import org.hibernate.property.Getter; //导入依赖的package包/类
@Override
public Getter getVersionGetter() {
if ( getEntityMetamodel().isVersioned() ) {
return getGetter( getEntityMetamodel().getVersionPropertyIndex() );
}
return null;
}
示例7: getGetter
import org.hibernate.property.Getter; //导入依赖的package包/类
private static Getter getGetter(Property mappingProperty) {
if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) {
return null;
}
PropertyAccessor pa = PropertyAccessorFactory.getPropertyAccessor( mappingProperty, EntityMode.POJO );
return pa.getGetter( mappingProperty.getPersistentClass().getMappedClass(), mappingProperty.getName() );
}
示例8: getUnsavedVersionValue
import org.hibernate.property.Getter; //导入依赖的package包/类
/**
* Return an IdentifierValue for the specified unsaved-value. If none is specified,
* guess the unsaved value by instantiating a test instance of the class and
* reading it's version property value, or if that is not possible, using the java default
* value for the type
*
* @param versionUnsavedValue The mapping defined unsaved value
* @param versionGetter The version attribute getter
* @param versionType The mapping type for the version
* @param constructor The constructor for the entity
*
* @return The appropriate VersionValue
*/
public static VersionValue getUnsavedVersionValue(
String versionUnsavedValue,
Getter versionGetter,
VersionType versionType,
Constructor constructor) {
if ( versionUnsavedValue == null ) {
if ( constructor!=null ) {
final Object defaultValue = versionGetter.get( instantiate( constructor ) );
// if the version of a newly instantiated object is not the same
// as the version seed value, use that as the unsaved-value
return versionType.isEqual( versionType.seed( null ), defaultValue )
? VersionValue.UNDEFINED
: new VersionValue( defaultValue );
}
else {
return VersionValue.UNDEFINED;
}
}
else if ( "undefined".equals( versionUnsavedValue ) ) {
return VersionValue.UNDEFINED;
}
else if ( "null".equals( versionUnsavedValue ) ) {
return VersionValue.NULL;
}
else if ( "negative".equals( versionUnsavedValue ) ) {
return VersionValue.NEGATIVE;
}
else {
// this should not happen since the DTD prevents it
throw new MappingException( "Could not parse version unsaved-value: " + versionUnsavedValue );
}
}
示例9: getter
import org.hibernate.property.Getter; //导入依赖的package包/类
private static Getter getter(Class clazz, String name) throws MappingException {
try {
return BASIC_PROPERTY_ACCESSOR.getGetter( clazz, name );
}
catch ( PropertyNotFoundException pnfe ) {
return DIRECT_PROPERTY_ACCESSOR.getGetter( clazz, name );
}
}
示例10: buildProxyFactory
import org.hibernate.property.Getter; //导入依赖的package包/类
@Override
protected ProxyFactory buildProxyFactory(PersistentClass thePersistentClass, Getter idGetter,
Setter idSetter) {
ProxyFactory pf = new MapProxyFactory();
try {
pf.postInstantiate(getEntityName(), null, null, null, null, null);
} catch (final HibernateException he) {
log.warn("could not create proxy factory for:" + getEntityName(), he);
pf = null;
}
return pf;
}
示例11: AbstractComponentTuplizer
import org.hibernate.property.Getter; //导入依赖的package包/类
protected AbstractComponentTuplizer(Component component) {
propertySpan = component.getPropertySpan();
getters = new Getter[propertySpan];
setters = new Setter[propertySpan];
Iterator iter = component.getPropertyIterator();
boolean foundCustomAccessor=false;
int i = 0;
while ( iter.hasNext() ) {
Property prop = ( Property ) iter.next();
getters[i] = buildGetter( component, prop );
setters[i] = buildSetter( component, prop );
if ( !prop.isBasicPropertyAccessor() ) {
foundCustomAccessor = true;
}
i++;
}
hasCustomAccessors = foundCustomAccessor;
String[] getterNames = new String[propertySpan];
String[] setterNames = new String[propertySpan];
Class[] propTypes = new Class[propertySpan];
for ( int j = 0; j < propertySpan; j++ ) {
getterNames[j] = getters[j].getMethodName();
setterNames[j] = setters[j].getMethodName();
propTypes[j] = getters[j].getReturnType();
}
instantiator = buildInstantiator( component );
}
示例12: getUnsavedVersionValue
import org.hibernate.property.Getter; //导入依赖的package包/类
public static VersionValue getUnsavedVersionValue(
String versionUnsavedValue,
Getter versionGetter,
VersionType versionType,
Constructor constructor) {
if ( versionUnsavedValue == null ) {
if ( constructor!=null ) {
Object defaultValue = versionGetter.get( instantiate(constructor) );
// if the version of a newly instantiated object is not the same
// as the version seed value, use that as the unsaved-value
return versionType.isEqual( versionType.seed( null ), defaultValue ) ?
VersionValue.UNDEFINED :
new VersionValue( defaultValue );
}
else {
return VersionValue.UNDEFINED;
}
}
else if ( "undefined".equals( versionUnsavedValue ) ) {
return VersionValue.UNDEFINED;
}
else if ( "null".equals( versionUnsavedValue ) ) {
return VersionValue.NULL;
}
else if ( "negative".equals( versionUnsavedValue ) ) {
return VersionValue.NEGATIVE;
}
else {
// this should not happen since the DTD prevents it
throw new MappingException( "Could not parse version unsaved-value: " + versionUnsavedValue );
}
}
示例13: getter
import org.hibernate.property.Getter; //导入依赖的package包/类
private static Getter getter(Class clazz, String name) throws MappingException {
try {
return BASIC_PROPERTY_ACCESSOR.getGetter(clazz, name);
}
catch (PropertyNotFoundException pnfe) {
return DIRECT_PROPERTY_ACCESSOR.getGetter(clazz, name);
}
}
示例14: buildProxyFactory
import org.hibernate.property.Getter; //导入依赖的package包/类
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
// allows defining a custom proxy factory, which is responsible for
// generating lazy proxies for a given entity.
//
// Here we simply use the default...
return super.buildProxyFactory( persistentClass, idGetter, idSetter );
}
示例15: testStringElementExtraction
import org.hibernate.property.Getter; //导入依赖的package包/类
public void testStringElementExtraction() throws Throwable {
Property property = generateNameProperty();
Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
.getGetter( null, null );
String name = ( String ) getter.get( DOM );
assertEquals( "Not equals", "JBoss", name );
}