Java Code Examples for net.bytebuddy.dynamic.DynamicType#Builder
The following examples show how to use
net.bytebuddy.dynamic.DynamicType#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapInAdjacentPropertiesHandler.java From windup with Eclipse Public License 1.0 | 5 votes |
@Override public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { String methodName = method.getName(); if (methodName.startsWith("get")) return createInterceptor(builder, method); else if (methodName.startsWith("set")) return createInterceptor(builder, method); throw new WindupException("Only get* and set* method names are supported for @" + MapInAdjacentProperties.class.getSimpleName()); }
Example 2
Source File: ByteBuddyGrpcFactory.java From joyrpc with Apache License 2.0 | 5 votes |
@Override protected Class<?> buildResponseClass(final Class<?> clz, final Method method, final Naming naming) { DynamicType.Builder<?> builder = new ByteBuddy(). with(new SimpleNamingStrategy(naming.getFullName())). subclass(Object.class). implement(Serializable.class). defineProperty(GrpcType.F_RESULT, method.getGenericReturnType()); return builder.make().load(Thread.currentThread().getContextClassLoader()).getLoaded(); }
Example 3
Source File: BeanBuilder.java From jackson-modules-base with Apache License 2.0 | 5 votes |
private DynamicType.Builder<?> createField(DynamicType.Builder<?> builder, POJOProperty property, TypeDefinition typeDefinition) { return builder.defineField( property.getName(), typeDefinition, Visibility.PROTECTED ); }
Example 4
Source File: InVertexMethodHandler.java From Ferma with Apache License 2.0 | 5 votes |
@Override public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { final java.lang.reflect.Parameter[] arguments = method.getParameters(); if (ReflectionUtility.isGetMethod(method)) if (arguments == null || arguments.length == 0) return this.getNode(builder, method, annotation); else throw new IllegalStateException(method.getName() + " was annotated with @InVertex but had arguments."); else throw new IllegalStateException(method.getName() + " was annotated with @InVertex but did not begin with: get"); }
Example 5
Source File: EnhancerImpl.java From lams with GNU General Public License v2.0 | 5 votes |
private static DynamicType.Builder<?> addFieldWithGetterAndSetter( DynamicType.Builder<?> builder, Class<?> type, String fieldName, String getterName, String setterName) { return builder .defineField( fieldName, type, Visibility.PRIVATE, FieldPersistence.TRANSIENT ) .annotateField( AnnotationDescription.Builder.ofType( Transient.class ).build() ) .defineMethod( getterName, type, Visibility.PUBLIC ) .intercept( FieldAccessor.ofField( fieldName ) ) .defineMethod( setterName, void.class, Visibility.PUBLIC ) .withParameters( type ) .intercept( FieldAccessor.ofField( fieldName ) ); }
Example 6
Source File: RebaseDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 4 votes |
protected DynamicType.Builder createDisabledRetention(Class<?> annotatedClass) { return new ByteBuddy().with(AnnotationRetention.DISABLED).rebase(annotatedClass); }
Example 7
Source File: AdjacencyMethodHandler.java From Ferma with Apache License 2.0 | 4 votes |
private <E> DynamicType.Builder<E> addVertexByTypeTypedEdge(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(AddVertexByTypeTypedEdgeInterceptor.class)); }
Example 8
Source File: WindupAdjacencyMethodHandler.java From windup with Eclipse Public License 1.0 | 4 votes |
private <E> DynamicType.Builder<E> removeVertex(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(RemoveVertexInterceptor.class)); }
Example 9
Source File: ByteBuddyState.java From lams with GNU General Public License v2.0 | 4 votes |
private Unloaded<?> make(DynamicType.Builder<?> builder) { return make( null, builder ); }
Example 10
Source File: RedefinitionDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 4 votes |
protected DynamicType.Builder<?> create(Class<?> type) { return new ByteBuddy().redefine(type); }
Example 11
Source File: IncidenceMethodHandler.java From Ferma with Apache License 2.0 | 4 votes |
private <E> DynamicType.Builder<E> getEdgeDefault(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(GetEdgeDefaultInterceptor.class)); }
Example 12
Source File: SimplePlugin.java From byte-buddy with Apache License 2.0 | 4 votes |
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) { return builder.method(named("foo")).intercept(FixedValue.value("qux")); }
Example 13
Source File: WindupAdjacencyMethodHandler.java From windup with Eclipse Public License 1.0 | 4 votes |
private <E> DynamicType.Builder<E> setVertexIterator(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(SetVertexIteratorInterceptor.class)); }
Example 14
Source File: RedefinitionDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 4 votes |
protected DynamicType.Builder createDisabledRetention(Class<?> annotatedClass) { return new ByteBuddy().with(AnnotationRetention.DISABLED).redefine(annotatedClass); }
Example 15
Source File: IllegalPlugin.java From byte-buddy with Apache License 2.0 | 4 votes |
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) { throw new RuntimeException(); }
Example 16
Source File: IncidenceMethodHandler.java From Ferma with Apache License 2.0 | 4 votes |
private <E> DynamicType.Builder<E> getEdgesSetDefault(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(GetEdgesSetDefaultInterceptor.class)); }
Example 17
Source File: WindupAdjacencyMethodHandler.java From windup with Eclipse Public License 1.0 | 4 votes |
private <E> DynamicType.Builder<E> getVertexDefault(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { return builder.method(ElementMatchers.is(method)).intercept(MethodDelegation.to(GetVertexDefaultInterceptor.class)); }
Example 18
Source File: Plugin.java From byte-buddy with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public DynamicType.Builder<?> builder(ByteBuddy byteBuddy, TypeDescription typeDescription, ClassFileLocator classFileLocator) { return byteBuddy.rebase(typeDescription, classFileLocator); }
Example 19
Source File: SubclassDynamicTypeBuilderTest.java From byte-buddy with Apache License 2.0 | 4 votes |
protected DynamicType.Builder<?> createPlainWithoutValidation() { return new ByteBuddy().with(TypeValidation.DISABLED).subclass(Object.class); }
Example 20
Source File: AbstractDynamicTypeBuilderForInliningTest.java From byte-buddy with Apache License 2.0 | votes |
protected abstract DynamicType.Builder<?> createDisabledRetention(Class<?> annotatedClass);