com.speedment.common.codegen.internal.MetaImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegen Show documentation
Show all versions of codegen Show documentation
An object-oriented code generator for Java that is built using the
Model-View-Controller (MVC) design philosophy.
/**
*
* Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.speedment.common.codegen.internal;
import com.speedment.common.codegen.*;
import static java.util.Objects.requireNonNull;
/**
* Meta implementation.
*
* @param the model type
* @param the result type
*/
public final class MetaImpl implements Meta {
private final A model;
private final B result;
private final Transform transform;
private final TransformFactory factory;
private final RenderStack stack;
private final RenderTree tree;
private MetaImpl(
A model,
B result,
Transform transform,
TransformFactory factory,
RenderStack stack,
RenderTree tree) {
this.model = requireNonNull(model);
this.result = requireNonNull(result);
this.transform = requireNonNull(transform);
this.factory = requireNonNull(factory);
this.stack = requireNonNull(stack);
this.tree = requireNonNull(tree);
}
@Override
public B getResult() {
return result;
}
@Override
public Transform getTransform() {
return transform;
}
@Override
public TransformFactory getFactory() {
return factory;
}
@Override
public A getModel() {
return model;
}
@Override
public RenderStack getRenderStack() {
return stack;
}
@Override
public RenderTree getRenderTree() {
return tree;
}
@Override
public String toString() {
return "MetaImpl{" + "model=" + model + ", result=" + result + ", transform=" + transform + ", factory=" + factory + ", stack=" + stack + ", tree=" + tree + '}';
}
public final static class Builder implements Meta.Builder {
private A model;
private B result;
private Transform transform;
private TransformFactory factory;
private RenderStack stack;
private RenderTree tree;
public Builder(A model, B result) {
this.model = requireNonNull(model);
this.result = requireNonNull(result);
}
@Override
public Meta.Builder withResult(B result) {
this.result = requireNonNull(result);
return this;
}
@Override
public Meta.Builder withTransform(Transform transform) {
this.transform = requireNonNull(transform);
return this;
}
@Override
public Meta.Builder withFactory(TransformFactory factory) {
this.factory = requireNonNull(factory);
return this;
}
@Override
public Meta.Builder withModel(A model) {
this.model = requireNonNull(model);
return this;
}
@Override
public Meta.Builder withRenderStack(RenderStack stack) {
this.stack = requireNonNull(stack);
return this;
}
@Override
public Meta.Builder withRenderTree(RenderTree tree) {
this.tree = requireNonNull(tree);
return this;
}
@Override
public Meta build() {
return new MetaImpl<>(
model,
result,
transform,
factory,
stack,
tree
);
}
}
}