Skip to content

How to declare more than one column name #11

Description

@ehayik

I'm deserializing a Java bean from an Excel spreadsheets using [Xcelite][1], and I've an attribute within it which can match more than one column name in different spreadsheets.

This is my Java Bean

    import com.ebay.xcelite.annotations.Column;

    public class User {
    
       @Column(name = "User") 
       private String username;
    
       @Column(name = "Email") 
       private String email;    
    }

I must deserialize the same object using another spreadsheet which instead of use User column name it use Login.

I could use the solution below, but I'd like to know if is there a better one ?

    public class User {
    
       @Column(name = "User") 
       private String username;

       @Column(name = "Login") 
       private String login;
    
       @Column(name = "Email") 
       private String email;   

       public String getUsername() {
          return username != null ? username : login;  
       }
    }

See https://stackoverflow.com/questions/57919157/how-to-declare-more-than-one-column-name-using-xcelite-library

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions