![JAR search and dependency download from the Maven repository](/logo.png)
org.apache.bval.jsr.metadata.MetadataBuilder Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.bval.jsr.metadata;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.bval.jsr.groups.GroupConversion;
/**
* Common interface for populating the Bean Validation descriptors from various sources. Most implementations should
* concern themselves with a single level of an inheritance hierarchy.
*/
public final class MetadataBuilder {
public interface ForBean extends HasAnnotationBehavior {
MetadataBuilder.ForClass getClass(Meta> meta);
Map> getFields(Meta> meta);
/**
* Returned keys are property names per XML mapping spec.
*
* @param meta
* @return {@link Map}
*/
Map> getGetters(Meta> meta);
Map>> getConstructors(Meta> meta);
Map> getMethods(Meta> meta);
default boolean isEmpty() {
return false;
}
}
public interface ForElement extends HasAnnotationBehavior {
Annotation[] getDeclaredConstraints(Meta meta);
default Map, Annotation[]> getConstraintDeclarationMap(Meta meta) {
return Collections.singletonMap(meta, getDeclaredConstraints(meta));
}
}
public interface ForClass extends ForElement> {
List> getGroupSequence(Meta> meta);
}
public interface ForContainer extends MetadataBuilder.ForElement {
boolean isCascade(Meta meta);
Set getGroupConversions(Meta meta);
Map> getContainerElementTypes(Meta meta);
}
public interface ForExecutable extends HasAnnotationBehavior {
MetadataBuilder.ForContainer getReturnValue(Meta meta);
MetadataBuilder.ForElement getCrossParameter(Meta meta);
List> getParameters(Meta meta);
}
private MetadataBuilder() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy