br.com.objectos.code.AnnotationValueInfoFakeBuilder Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2014 Objectos, Fábrica de Software LTDA.
*
* 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.
*/
package br.com.objectos.code;
import com.google.common.collect.ImmutableList;
/**
* @author [email protected] (Marcio Endo)
*/
class AnnotationValueInfoFakeBuilder {
private String name;
private AnnotationValueKind kind;
private Object value;
public AnnotationValueInfo build() {
return TestingAnnotationValueInfo.builder()
.name(name)
.kind(kind)
.value(value)
.build();
}
public AnnotationValueInfoFakeBuilder name(String name) {
this.name = name;
return this;
}
public AnnotationValueInfoFakeBuilder arrayAnnotation(AnnotationInfo... values) {
kind = AnnotationValueKind.ARRAY_ANNOTATION;
value = ImmutableList.copyOf(values);
return this;
}
public AnnotationValueInfoFakeBuilder arrayEnum() {
kind = AnnotationValueKind.ARRAY_ENUM;
value = ImmutableList.of();
return this;
}
public AnnotationValueInfoFakeBuilder arrayEnum(EnumConstantInfo... enumConstantInfo) {
kind = AnnotationValueKind.ARRAY_ENUM;
value = ImmutableList.copyOf(enumConstantInfo);
return this;
}
public AnnotationValueInfoFakeBuilder arrayType(SimpleTypeInfo... simpleTypeInfo) {
kind = AnnotationValueKind.ARRAY_TYPE;
value = ImmutableList.copyOf(simpleTypeInfo);
return this;
}
public AnnotationValueInfoFakeBuilder booleanValue(boolean bool) {
kind = AnnotationValueKind.PRIMITIVE_BOOLEAN;
value = bool;
return this;
}
public AnnotationValueInfoFakeBuilder charValue(char character) {
kind = AnnotationValueKind.PRIMITIVE_CHAR;
value = character;
return this;
}
public AnnotationValueInfoFakeBuilder enumValue(EnumConstantInfo enumConstantInfo) {
kind = AnnotationValueKind.ENUM;
value = enumConstantInfo;
return this;
}
public AnnotationValueInfoFakeBuilder intValue(int value) {
kind = AnnotationValueKind.PRIMITIVE_INT;
this.value = value;
return this;
}
public AnnotationValueInfoFakeBuilder string(String string) {
kind = AnnotationValueKind.STRING;
value = string;
return this;
}
public AnnotationValueInfoFakeBuilder simpleTypeInfo(SimpleTypeInfo simpleTypeInfo) {
kind = AnnotationValueKind.TYPE;
value = simpleTypeInfo;
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy