Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
HHH-7484 Removing unnecessary ColumnSourceImpl#resolveColumnName
  • Loading branch information
hferentschik committed Aug 1, 2012
1 parent d8c4c26 commit 57be2cf
Showing 1 changed file with 3 additions and 22 deletions.
Expand Up @@ -23,43 +23,24 @@
*/
package org.hibernate.metamodel.internal.source.annotations.attribute;

import org.hibernate.internal.util.StringHelper;

/**
* @author Hardy Ferentschik
*/
public class ColumnSourceImpl extends ColumnValuesSourceImpl {
private final MappedAttribute attribute;
private final String name;

ColumnSourceImpl(MappedAttribute attribute, AttributeOverride attributeOverride, Column columnValues) {
super( columnValues );
if ( attributeOverride != null ) {
setOverrideColumnValues( attributeOverride.getColumnValues() );
}
this.attribute = attribute;
this.name = resolveColumnName();
}

protected String resolveColumnName() {
if ( StringHelper.isEmpty( super.getName() ) ) {
//no @Column defined.
return null;
}
else {
return super.getName();
}
}

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

@Override
public String getReadFragment() {
if ( attribute instanceof BasicAttribute ) {
return ( (BasicAttribute) attribute ).getCustomReadFragment();
return ( ( BasicAttribute ) attribute ).getCustomReadFragment();
}
else {
return null;
Expand All @@ -69,7 +50,7 @@ public String getReadFragment() {
@Override
public String getWriteFragment() {
if ( attribute instanceof BasicAttribute ) {
return ( (BasicAttribute) attribute ).getCustomWriteFragment();
return ( ( BasicAttribute ) attribute ).getCustomWriteFragment();
}
else {
return null;
Expand All @@ -79,7 +60,7 @@ public String getWriteFragment() {
@Override
public String getCheckCondition() {
if ( attribute instanceof BasicAttribute ) {
return ( (BasicAttribute) attribute ).getCheckCondition();
return attribute.getCheckCondition();
}
else {
return null;
Expand Down

0 comments on commit 57be2cf

Please sign in to comment.