public class Eggg extends Object
// for snack4 demo
public class EgggUtil {
private static final Eggg eggg = new Eggg()
.withCreatorClass(ONodeCreator.class)
.withDigestHandler(EgggUtil::doDigestHandle)
.withAliasHandler(EgggUtil::doAliasHandle);
private static String doAliasHandle(ClassEggg cw, AnnotatedEggg s, String ref) {
if (s.getDigest() instanceof ONodeAttrHolder) {
return ((ONodeAttrHolder) s.getDigest()).getAlias();
} else {
return ref;
}
}
private static Object doDigestHandle(ClassEggg cw, AnnotatedEggg s, Object ref) {
ONodeAttr attr = s.getElement().getAnnotation(ONodeAttr.class);
if (attr == null && ref != null) {
return ref;
}
if (s instanceof FieldEggg) {
return new ONodeAttrHolder(attr, ((Field) s.getElement()).getName());
} else if (s instanceof PropertyMethodEggg) {
return new ONodeAttrHolder(attr, Property.resolvePropertyName(((Method) s.getElement()).getName()));
} else if (s instanceof ParamEggg) {
return new ONodeAttrHolder(attr, ((Parameter) s.getElement()).getName());
} else {
return null;
}
}
public static TypeEggg getTypeEggg(Type type) {
return eggg.getTypeEggg(type);
}
}
| Constructor and Description |
|---|
Eggg() |
public Eggg withCreatorClass(Class<? extends Annotation> creatorClass)
public Eggg withCreatorMatcher(CreatorMatcher creatorMatcher)
public Eggg withAliasHandler(AliasHandler aliasHandler)
public Eggg withDigestHandler(DigestHandler digestHandler)
public Eggg withReflectHandler(ReflectHandler reflectHandler)
public Eggg withGenericResolver(GenericResolver genericResolver)
public void clear()
public MethodEggg newMethodEggg(ClassEggg classEggg, Method method)
public ConstrEggg newConstrEggg(ClassEggg classEggg, Executable constr, boolean isCreator)
public PropertyMethodEggg newPropertyMethodEggg(ClassEggg classEggg, MethodEggg methodEggg)
public ParamEggg newParamEggg(ClassEggg classEggg, ExecutableEggg execEggg, Parameter param)
public Map<String,Type> findGenericInfo(TypeEggg owner, Class<?> declaringClass)
protected Object findDigest(ClassEggg classEggg, AnnotatedEggg source, Object defaultValue)
protected String findAlias(ClassEggg classEggg, AnnotatedEggg source, String defaultValue)
protected boolean findCreator(Executable executable)
Copyright © 2025. All rights reserved.