@Override public boolean test( Composite item ) { Property<T> prop = property.apply( item ); if( prop == null ) { return false; } return prop.get() != null; }
@Override public String toString() { return property.toString() + "is null"; } }
private TraversedAssoOrManyAssoRef( PropertyFunction<?> func ) { this( func.traversedAssociation(), func.traversedManyAssociation() ); }
public Triple addTriple( final PropertyFunction<?> propertyFunction, boolean optional ) { String subject = "?entity"; if( propertyFunction.traversedAssociation() != null ) { subject = addTripleAssociation( propertyFunction.traversedAssociation(), false ).value; } else if( propertyFunction.traversedProperty() != null ) { subject = addTriple( propertyFunction.traversedProperty(), false ).value; } QualifiedName qualifiedName = QualifiedName.fromAccessor( propertyFunction.accessor() ); String prefix = addNamespace( qualifiedName.toNamespace() ); return addTriple( subject, prefix + ":" + qualifiedName.name(), optional ); }
@Override public Object invoke( Object o, final Method method, Object[] objects ) throws Throwable { if( method.equals( Property.class.getMethod( "get" ) ) ) { Type propertyType = GenericPropertyInfo.propertyTypeOf( property.accessor() ); if( propertyType.getClass().equals( Class.class ) ) { return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(), array( (Class<?>) propertyType, PropertyReference.class ), new TemplateHandler<T>( property, null, null, null ) ); } } return null; } }
qNameStack.add( QualifiedName.fromAccessor( reference.accessor() ) ); refStack.add( reference ); if( reference.traversedProperty() == null && ( reference.traversedAssociation() != null || reference.traversedManyAssociation() != null ) ) reference = reference.traversedProperty();
/** * Create a new Query Property instance. * * @param <T> type of the Property * @param mixinClass mixin of the Property * @param fieldName name of the Property field * * @return a new Query Property instance for the given mixin and property name. */ @SuppressWarnings( "unchecked" ) public static <T> Property<T> property( Class<?> mixinClass, String fieldName ) { try { Field field = mixinClass.getField( fieldName ); if( !Property.class.isAssignableFrom( field.getType() ) ) { throw new IllegalArgumentException( "Field must be of type Property<?>" ); } return (Property<T>) Proxy.newProxyInstance( mixinClass.getClassLoader(), array( field.getType() ), new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) ); } catch( NoSuchFieldException e ) { throw new IllegalArgumentException( "No such field '" + fieldName + "' in mixin " + mixinClass.getName() ); } }
public Triple addTriple( final PropertyFunction<?> propertyFunction, boolean optional ) { String subject = "?entity"; if( propertyFunction.traversedAssociation() != null ) { subject = addTripleAssociation( propertyFunction.traversedAssociation(), false ).value; } else if( propertyFunction.traversedProperty() != null ) { subject = addTriple( propertyFunction.traversedProperty(), false ).value; } QualifiedName qualifiedName = QualifiedName.fromAccessor( propertyFunction.accessor() ); String prefix = addNamespace( qualifiedName.toNamespace() ); return addTriple( subject, prefix + ":" + qualifiedName.name(), optional ); }
@Override public Object invoke( Object o, final Method method, Object[] objects ) throws Throwable { if( method.equals( Property.class.getMethod( "get" ) ) ) { Type propertyType = GenericPropertyInfo.propertyTypeOf( property.accessor() ); if( propertyType.getClass().equals( Class.class ) ) { return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(), array( (Class<?>) propertyType, PropertyReference.class ), new TemplateHandler<T>( property, null, null, null ) ); } } return null; } }
/** * Create a new Query Property instance. * * @param <T> type of the Property * @param mixinClass mixin of the Property * @param fieldName name of the Property field * * @return a new Query Property instance for the given mixin and property name. */ @SuppressWarnings( "unchecked" ) public static <T> Property<T> property( Class<?> mixinClass, String fieldName ) { try { Field field = mixinClass.getField( fieldName ); if( !Property.class.isAssignableFrom( field.getType() ) ) { throw new IllegalArgumentException( "Field must be of type Property<?>" ); } return (Property<T>) Proxy.newProxyInstance( mixinClass.getClassLoader(), array( field.getType() ), new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) ); } catch( NoSuchFieldException e ) { throw new IllegalArgumentException( "No such field '" + fieldName + "' in mixin " + mixinClass.getName() ); } }
QualifiedName qName = QualifiedName.fromAccessor( ref.accessor() ); QNameInfo info = this._state.qNameInfos().get().get( qName ); qNames[ idx ] = info; .getFrom() .getTableReferences().iterator().next(), JoinType.LEFT_OUTER ); Class<?> declaringType = ( (Member) ref.accessor() ).getDeclaringClass(); String colName; Integer tableIdx;
@Override public String toString() { return property.toString() + "is not null"; } }
@Override public boolean test( Composite item ) { Property<T> prop = property.apply( item ); if( prop == null ) { return true; } return prop.get() == null; }
/** * Create a new EQUALS specification for an Association. * * @param <T> Association type * @param association an Association * @param value its value * * @return a new EQUALS specification for an Association. */ public static <T> EqPredicate<Identity> eq( Association<T> association, T value ) { return new EqPredicate<>( new PropertyFunction<>( null, association(association), null, null, IDENTITY_METHOD), ((HasIdentity) value).identity().get()); }
= QualifiedName.fromAccessor( predicate.property().accessor() ); String columnName; Object value;
@Override public String toString() { return property.toString() + "is null"; } }
@Override public boolean test( Composite item ) { Collection<T> collection = collectionProperty.apply( item ).get(); if( collection == null ) { return false; } return collection.contains( value ); }
/** * Create a new EQUALS specification for an Association. * * @param <T> Association type * @param association an Association * @param value its value * * @return a new EQUALS specification for an Association. */ public static <T> EqPredicate<Identity> eq( Association<T> association, T value ) { return new EqPredicate<>( new PropertyFunction<>( null, association(association), null, null, IDENTITY_METHOD), ((HasIdentity) value).identity().get()); }
String propName = ((Member)orderBySegment.property().accessor()).getName() + "_for_sort"; String order = orderBySegment.order() == OrderBy.Order.ASCENDING ? "asc" : "desc"; list.add( "sort", propName + " " + order );
@Override public String toString() { return property.toString() + "is not null"; } }