Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't serialize an array #189

Open
KimiChiu opened this issue Dec 5, 2016 · 0 comments
Open

Can't serialize an array #189

KimiChiu opened this issue Dec 5, 2016 · 0 comments

Comments

@KimiChiu
Copy link

KimiChiu commented Dec 5, 2016

apt 'com.bluelinelabs:logansquare-compiler:1.3.6'
compile 'com.bluelinelabs:logansquare:1.3.6'
@JsonObject
public class AnsiFont implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonField
    private String foregroundColor;

    @JsonField
    private String backgroundColor;

    @JsonField
    private boolean underline = false;

    @JsonField
    private boolean hyperLink = false;

    public String getForegroundColor() {
        return foregroundColor;
    }

    public void setForegroundColor(String foregroundColor) {
        this.foregroundColor = foregroundColor;
    }

    public String getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(String backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public boolean isUnderline() {
        return underline;
    }

    public void setUnderline(boolean underline) {
        this.underline = underline;
    }

    public boolean isHyperLink() {
        return hyperLink;
    }

    public void setHyperLink(boolean hyperLink) {
        this.hyperLink = hyperLink;
    }

    public AnsiFont clone(){
        return AnsiFont.Builder.anAnsiFont()
                .withForegroundColor( foregroundColor )
                .withBackgroundColor( backgroundColor )
                .withHyperLink( hyperLink )
                .withUnderline( underline )
                .build();
    }

    public static class Builder {
        private String foregroundColor;
        private String backgroundColor;
        private boolean underline = false;
        private boolean hyperLink = false;

        private Builder() {
        }

        public static Builder anAnsiFont() {
            return new Builder();
        }

        public Builder withForegroundColor(String foregroundColor) {
            this.foregroundColor = foregroundColor;
            return this;
        }

        public Builder withBackgroundColor(String backgroundColor) {
            this.backgroundColor = backgroundColor;
            return this;
        }

        public Builder withUnderline(boolean underline) {
            this.underline = underline;
            return this;
        }

        public Builder withHyperLink(boolean hyperLink) {
            this.hyperLink = hyperLink;
            return this;
        }

        public Builder but() {
            return anAnsiFont().withForegroundColor(foregroundColor).withBackgroundColor(backgroundColor).withUnderline(underline).withHyperLink(hyperLink);
        }

        public AnsiFont build() {
            AnsiFont ansiFont = new AnsiFont();
            ansiFont.setForegroundColor(foregroundColor);
            ansiFont.setBackgroundColor(backgroundColor);
            ansiFont.setUnderline(underline);
            ansiFont.setHyperLink(hyperLink);
            return ansiFont;
        }
    }
}
AnsiFont[][] fonts = new AnsiFont[30][30];
// NoSuchMapperException
LoganSquare.serialize(fonts);
// NoSuchMapperException
LoganSquare.serialize(fonts[0]);
// Success
LoganSquare.serialize(fonts[0][0]);

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant