Java 类javax.persistence.ColumnResult 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
private static ConstructorResult buildConstructorResult(Element constructorResultElement, XMLContext.Default defaults) {
    AnnotationDescriptor constructorResultDescriptor = new AnnotationDescriptor( ConstructorResult.class );

    final Class entityClass = resolveClassReference( constructorResultElement.attributeValue( "target-class" ), defaults );
    constructorResultDescriptor.setValue( "targetClass", entityClass );

    List<ColumnResult> columnResultAnnotations = new ArrayList<ColumnResult>();
    for ( Element columnResultElement : (List<Element>) constructorResultElement.elements( "column" ) ) {
        columnResultAnnotations.add( buildColumnResult( columnResultElement, defaults ) );
    }
    constructorResultDescriptor.setValue(
            "columns",
            columnResultAnnotations.toArray( new ColumnResult[ columnResultAnnotations.size() ] )
    );

    return AnnotationFactory.create( constructorResultDescriptor );
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private static ColumnResult buildColumnResult(Element columnResultElement, XMLContext.Default defaults) {
//      AnnotationDescriptor columnResultDescriptor = new AnnotationDescriptor( ColumnResult.class );
//      copyStringAttribute( columnResultDescriptor, columnResultElement, "name", true );
//      return AnnotationFactory.create( columnResultDescriptor );

        AnnotationDescriptor columnResultDescriptor = new AnnotationDescriptor( ColumnResult.class );
        copyStringAttribute( columnResultDescriptor, columnResultElement, "name", true );
        final String columnTypeName = columnResultElement.attributeValue( "class" );
        if ( StringHelper.isNotEmpty( columnTypeName ) ) {
            columnResultDescriptor.setValue( "type", resolveClassReference( columnTypeName, defaults ) );
        }
        return AnnotationFactory.create( columnResultDescriptor );
    }