private AccessibleObject getAccessor() { return this._traversedAsso == null ? this._traversedManyAsso.accessor() : this._traversedAsso.accessor(); }
@Override public String toString() { return association.toString() + " is not null"; } }
private TraversedAssoOrManyAssoRef( AssociationFunction<?> func ) { this( func.traversedAssociation(), func.traversedManyAssociation() ); }
public Triple addTripleAssociation( AssociationFunction<?> associationReference, boolean optional ) { String subject = "?entity"; if( associationReference.traversedAssociation() != null ) { subject = addTripleAssociation( associationReference.traversedAssociation(), false ).value; } QualifiedName qualifiedName = QualifiedName.fromAccessor( associationReference.accessor() ); String prefix = addNamespace( qualifiedName.toNamespace() ); return addTriple( subject, prefix + ":" + qualifiedName.name(), optional ); }
@Override public boolean test( Composite item ) { try { Association<T> assoc = association.apply( item ); if( assoc == null ) { return false; } return assoc.get() != null; } catch( IllegalArgumentException e ) { return false; } }
method.getReturnType().getClassLoader(), array( method.getReturnType() ), new AssociationReferenceHandler<>( new AssociationFunction<T>( compositeAssociation, compositeManyAssociation, compositeNamedAssociation,
public Triple addTripleAssociation( AssociationFunction<?> associationReference, boolean optional ) { String subject = "?entity"; if( associationReference.traversedAssociation() != null ) { subject = addTripleAssociation( associationReference.traversedAssociation(), false ).value; } QualifiedName qualifiedName = QualifiedName.fromAccessor( associationReference.accessor() ); String prefix = addNamespace( qualifiedName.toNamespace() ); return addTriple( subject, prefix + ":" + qualifiedName.name(), optional ); }
@Override public boolean test( Composite item ) { try { Association<T> assoc = association.apply( item ); if( assoc == null ) { return true; } return assoc.get() == null; } catch( IllegalArgumentException e ) { return true; } }
method.getReturnType().getClassLoader(), array( method.getReturnType() ), new AssociationReferenceHandler<>( new AssociationFunction<T>( compositeAssociation, compositeManyAssociation, compositeNamedAssociation,
@Override public String toString() { return association.toString() + " is null"; } }
@Override public Object invoke( Object o, final Method method, Object[] objects ) throws Throwable { if( method.equals( Association.class.getMethod( "get" ) ) ) { Type associationType = GenericAssociationInfo.associationTypeOf( association.accessor() ); if( associationType.getClass().equals( Class.class ) ) { return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(), array( (Class) associationType, PropertyReference.class ), new TemplateHandler<T>( null, association, null, null ) ); } } return null; } }
@Override public boolean test( Composite item ) { try { Association<T> assoc = association.apply( item ); if( assoc == null ) { return false; } return assoc.get() != null; } catch( IllegalArgumentException e ) { return false; } }
Proxy.newProxyInstance( field.getType().getClassLoader(), array( field.getType() ), new AssociationReferenceHandler<>( new AssociationFunction<T>( null, null, null, field ) ) ) );
@Override public String toString() { return association.toString() + " is not null"; } }
@Override public Object invoke( Object o, final Method method, Object[] objects ) throws Throwable { if( method.equals( Association.class.getMethod( "get" ) ) ) { Type associationType = GenericAssociationInfo.associationTypeOf( association.accessor() ); if( associationType.getClass().equals( Class.class ) ) { return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(), array( (Class) associationType, PropertyReference.class ), new TemplateHandler<T>( null, association, null, null ) ); } } return null; } }
@Override public boolean test( Composite item ) { try { Association<T> assoc = association.apply( item ); if( assoc == null ) { return true; } return assoc.get() == null; } catch( IllegalArgumentException e ) { return true; } }
Proxy.newProxyInstance( field.getType().getClassLoader(), array( field.getType() ), new AssociationReferenceHandler<>( new AssociationFunction<T>( null, null, null, field ) ) ) );
@Override public String toString() { return association.toString() + " is null"; } }
@Override public NamedAssociation<T> apply( Composite entity ) { try { Object target = entity; if( traversedAssociation != null ) { target = traversedAssociation.apply( entity ).get(); } if( traversedManyAssociation != null ) { throw new IllegalArgumentException( "Cannot traverse ManyAssociations" ); } if( traversedNamedAssociation != null ) { throw new IllegalArgumentException( "Cannot traverse NamedAssociations" ); } CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target ); return ( (AssociationStateHolder) handler.state() ).namedAssociationFor( accessor ); } catch( IllegalArgumentException e ) { throw e; } catch( Throwable e ) { throw new IllegalArgumentException( e ); } }
@Override public String toString() { if( traversedAssociation != null ) { return traversedAssociation.toString() + "." + ( (Member) accessor ).getName(); } else { return ( (Member) accessor ).getName(); } } }